操作系统系统调用数据结构.docx

上传人:b****6 文档编号:8111673 上传时间:2023-01-28 格式:DOCX 页数:30 大小:33.29KB
下载 相关 举报
操作系统系统调用数据结构.docx_第1页
第1页 / 共30页
操作系统系统调用数据结构.docx_第2页
第2页 / 共30页
操作系统系统调用数据结构.docx_第3页
第3页 / 共30页
操作系统系统调用数据结构.docx_第4页
第4页 / 共30页
操作系统系统调用数据结构.docx_第5页
第5页 / 共30页
点击查看更多>>
下载资源
资源描述

操作系统系统调用数据结构.docx

《操作系统系统调用数据结构.docx》由会员分享,可在线阅读,更多相关《操作系统系统调用数据结构.docx(30页珍藏版)》请在冰豆网上搜索。

操作系统系统调用数据结构.docx

操作系统系统调用数据结构

OSVERSIONINFOEX

[Thisispreliminarydocumentationandsubjecttochange.]

TheOSVERSIONINFOEXstructurecontainsoperatingsystemversioninformation.Theinformationincludesmajorandminorversionnumbers,abuildnumber,aplatformidentifier,andinformationaboutthelatestServicePackinstalledonthesystem.ThisstructureisusedwiththeGetVersionExfunction.OSVERSIONINFOEXisanextendedversionoftheOSVERSIONINFOstructure.

typedefstruct_OSVERSIONINFOEXA{

DWORDdwOSVersionInfoSize;

DWORDdwMajorVersion;

DWORDdwMinorVersion;

DWORDdwBuildNumber;

DWORDdwPlatformId;

TCHARszCSDVersion[128];

WORDwServicePackMajor;

WORDwServicePackMinor;

WORDwReserved[2];

}OSVERSIONINFOEXA,*POSVERSIONINFOEXA,*LPOSVERSIONINFOEXA;

Members

dwOSVersionInfoSize

Specifiesthesize,inbytes,ofthisdatastructure.Setthismembertosizeof(OSVERSIONINFOEX)beforecallingtheGetVersionExfunction.

dwMajorVersion

Identifiesthemajorversionnumberoftheoperatingsystem.Forexample,forWindowsNTversion5.0,themajorversionnumberis5.

dwMinorVersion

Identifiestheminorversionnumberoftheoperatingsystem.Forexample,forWindowsNTversion5.0,theminorversionnumberis0.

dwBuildNumber

Identifiesthebuildnumberoftheoperatingsystem.

dwPlatformId

Identifiestheoperatingsystemplatform.Thismembercanbeoneofthefollowingvalues.

Value

Platform

VER_PLATFORM_WIN32s

Win32sonWindows3.1.

VER_PLATFORM_WIN32_WINDOWS

Win32onWindows95orWindows98.

VER_PLATFORM_WIN32_NT

Win32onWindowsNT.

szCSDVersion

Containsanull-terminatedstring,suchas"ServicePack3",thatindicatesthelatestServicePackinstalledonthesystem.IfnoServicePackhasbeeninstalled,thestringisempty.

wServicePackMajor

IdentifiesthemajorversionnumberofthelatestServicePackinstalledonthesystem.IfnoServicePackhasbeeninstalled,thevalueiszero.

wServicePackMinor

IdentifiestheminorversionnumberofthelatestServicePackinstalledonthesystem.IfnoServicePackhasbeeninstalled,thevalueiszero.

wReserved

Reservedforfutureuse.

QuickInfo

  WindowsNT:

Requiresversion5.0orlater.

  Windows:

Unsupported.

  WindowsCE:

Unsupported.

  Header:

Declaredinwinbase.h.

  Unicode:

DefinedasUnicodeandANSIstructures.

GetProcessVersion

TheGetProcessVersionfunctionobtainsthemajorandminorversionnumbersofthesystemonwhichaspecifiedprocessexpectstorun.

DWORDGetProcessVersion(

DWORDProcessId//identifierspecifyingtheprocessofinterest

);

Parameters

ProcessId

Processidentifierthatspecifiestheprocessofinterest.AProcessIdvalueofzerospecifiesthecallingprocess.

ReturnValues

Ifthefunctionsucceeds,thereturnvalueistheversionofthesystemonwhichtheprocessexpectstorun.Thehighwordofthereturnvaluecontainsthemajorversionnumber.Thelowwordofthereturnvaluecontainstheminorversionnumber.

Ifthefunctionfails,thereturnvalueiszero.Togetextendederrorinformation,callGetLastError.ThefunctionfailsifProcessIdisaninvalidvalue.

Remarks

TheGetProcessVersionfunctionperformslessquicklywhenProcessIdisnonzero,specifyingaprocessotherthanthecallingprocess.

Theversionnumberreturnedbythisfunctionistheversionnumberstampedintheimageheaderofthe.EXEfiletheprocessisrunning.Linkerprogramssetthisvalue.

QuickInfo

  WindowsNT:

Requiresversion3.51orlater.

  Windows:

RequiresWindows95orlater.

  WindowsCE:

Unsupported.

  Header:

Declaredinwinbase.h.

  ImportLibrary:

Usekernel32.lib.

GetVersionEx

TheGetVersionExfunctionobtainsextendedinformationabouttheversionoftheoperatingsystemthatiscurrentlyrunning.

BOOLGetVersionEx(

LPOSVERSIONINFOlpVersionInformation//pointertoversion

//informationstructure

);

Parameters

lpVersionInformation

PointertoanOSVERSIONINFOdatastructurethatthefunctionfillswithoperatingsystemversioninformation.

BeforecallingtheGetVersionExfunction,setthedwOSVersionInfoSizememberoftheOSVERSIONINFOdatastructuretosizeof(OSVERSIONINFO).

WindowsNT5.0andlater:

ThismembercanbeapointertoanOSVERSIONINFOEXstructure.SetthedwOSVersionInfoSizemembertosizeof(OSVERSIONINFOEX)toidentifythetypeofstructure.

ReturnValues

Ifthefunctionsucceeds,thereturnvalueisnonzero.

Ifthefunctionfails,thereturnvalueiszero.Togetextendederrorinformation,call

GetLastError.ThefunctionfailsifyouspecifyaninvalidvalueforthedwOSVersionInfoSizememberoftheOSVERSIONINFOorOSVERSIONINFOEXstructure.

Remarks

WhenusingtheGetVersionExfunctiontodeterminewhetheryourapplicationisrunningonaparticularversionoftheoperatingsystem,checkforversionnumbersthataregreaterthanorequaltothedesiredversionnumbers.Thisensuresthatthetestsucceedsforlaterversionsoftheoperatingsystem.Forexample,ifyourapplicationrequiresWindows98,usethefollowingtest:

GetVersionEx(&osvi);

bIsWindows98orLater=

(osvi.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)&&

((osvi.dwMajorVersion>4)||

((osvi.dwMajorVersion==4)&&(osvi.dwMinorVersion>0)));

Identifyingthecurrentoperatingsystemisusuallynotthebestwaytodeterminewhetheraparticularoperatingsystemfeatureispresent.ThisisbecausetheoperatingsystemmayhavehadnewfeaturesaddedinaredistributableDLL.RatherthanusingGetVersionExtodeterminetheoperatingsystemplatformorversionnumber,testforthepresenceofthefeatureitself.

Todeterminethebestwaytotestforafeature,refertothedocumentationforthefeatureofinterest.Thefollowinglistdiscussessomecommontechniquesforfeaturedetection:

∙Youcantestforthepresenceofthefunctionsassociatedwithafeature.TotestforthepresenceofafunctioninasystemDLL,callthe

LoadLibraryfunctiontoloadtheDLL.Thencallthe

GetProcAddressfunctiontodeterminewhetherthefunctionofinterestispresentintheDLL.UsethepointerreturnedbyGetProcAddresstocallthefunction.Notethatevenifthefunctionispresent,itmaybeastubthatjustreturnsanerrorcodesuchasERROR_CALL_NOT_IMPLEMENTED.

∙YoucandeterminethepresenceofsomefeaturesbyusingtheGetSystemMetricsfunction.Forexample,youcandetectmultipledisplaymonitorsbycallingGetSystemMetrics(SM_CMONITORS).

∙ThereareseveralversionsoftheredistributableDLLsthatimplementshellandcommoncontrolfeatures.Forinformationaboutdeterminingwhichversionsarepresentonthesystemyourapplicationisrunningon,seethetopic

ShellVersions.

WindowsCE:

ThevalueofthedwPlatformIDmemberoftheOSVERSIONINFOstructurewillbeVER_PLATFORM_WIN32_CE.

QuickInfo

  WindowsNT:

Requiresversion3.5orlater.

  Windows:

RequiresWindows95orlater.

  WindowsCE:

Requiresversion1.0orlater.

  Header:

Declaredinwinbase.h.

  ImportLibrary:

Usekernel32.lib.

  Unicode:

ImplementedasUnicodeandANSIversionsonWindowsNT.

GetPriorityClass

TheGetPriorityClassfunctionreturnsthepriorityclassforthespecifiedprocess.Thisvalue,togetherwiththepriorityvalueofeachthreadoftheprocess,determineseachthread'sbaseprioritylevel.

DWORDGetPriorityClass(

HANDLEhProcess//handletotheprocess

);

Parameters

hProcess

Handletotheprocess.

WindowsNT:

ThehandlemusthavePROCESS_QUERY_INFORMATIONaccess.

ReturnValues

Ifthefunctionsucceeds,thereturnvalueisthepriorityclassofthespecifiedprocess.

Ifthefunctionfails,thereturnvalueiszero.Togetextendederrorinformation,callGetLastError.

Theprocess'spriorityclassisoneofthefollowingvalues:

Priority

Meaning

HIGH_PRIORITY_CLASS

Indicatesaprocessthatperformstime-criticaltasksthatmustbeexecutedimmediatelyforittoruncorrectly.Thethreadsofahigh-priorityclassprocesspreemptthethreadsofnormaloridlepriorityclassprocesses.AnexampleistheTaskList,whichmustrespondquicklywhencalledbytheuser,regardlessoftheloadontheoperatingsystem.Useextremecarewhenusingthehigh-priorityclass,becauseahigh-priorityclassCPU-boundapplicationcanusenearlyallavailablecycles.

IDLE_PRIORITY_CLASS

Indicatesaprocesswhosethreadsrunonlywhenthesystemisidleandarepreemptedbythethreadsofanyprocessrunninginahigherpriorityclass.Anexampleisascreensaver.Theidlepriorityclassisinheritedbychildprocesses.

NORMAL_PRIORITY_CLASS

Indicatesanormalprocesswithnospecialschedulingneeds.

REALTIME_PRIORITY_CLASS

Indicatesaprocessthathasthehighestpossiblepriority.Thethreadsofareal-timepriorityclassprocesspreemptthethreadsofallotherprocesses,includingoperatingsystemprocessesperformingimportanttasks.Forexample,areal-timeprocessthatexecutesformorethanaverybriefintervalcancausediskcachesnottoflushorcausethemousetobeunresponsive.

Remarks

Everythreadhasabasepriorityleveldeterminedbythethread'spriorityvalueandthepriorityclassofitsprocess.TheoperatingsystemusesthebaseprioritylevelofallexecutablethreadstodeterminewhichthreadgetsthenextsliceofCPUtime.Threadsarescheduledinaround-robinfashionateachprioritylevel,andonlywhentherearenoexecutablethreadsatahigherlevelwillschedulingofthreadsatalowerleveltakeplace.

Foratablethatshowsthebaseprioritylevelsforeachcombinationofpriorityclassandthreadpriorityvalue,seetheSetPriorityClassfunction.

QuickInfo

  WindowsNT:

Requiresversion3.1orlater.

  Windows:

RequiresWindows95orlater.

  WindowsCE:

Unsupported.

  Header:

Declaredinwinbase.h.

  ImportLibrar

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 总结汇报 > 其它

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1