Leaderboard
Popular Content
Showing content with the highest reputation on 01/03/2024 in all areas
-
zPlayer - My own little audio/video player
argumentum and one other reacted to ioa747 for a topic
Take a look https://github.com/microsoft/Windows-Dev-Performance/issues/20 reading your post, this morning I did something similar, here it is Edit: Windows 10 Pro 22H22 points -
zPlayer - My own little audio/video player
argumentum and one other reacted to CYCho for a topic
I used the following code to measure the time taken by each property. ; File name: GetDetailsOf_Time_Comparison.au3 #include <Array.au3> #include <File.au3> Global $aInfo[329][6] $aInfo[0][0] = "Index" $aInfo[0][1] = "Property Name" $aInfo[0][2] = "MP4 Property Value" $aInfo[0][3] = "MP4 Time" $aInfo[0][4] = "MKV Property Value" $aInfo[0][5] = "MKV Time" $oShellApp = ObjCreate("shell.application") Global $sFileName, $sDir, $oDir, $oFile Global $sPath = "E:\Movies\다이하드\Die Hard 1990 1080p.mp4.mkv" $sFileName = StringMid($sPath, StringInStr($sPath, "\", 0, -1)+1) $sDir = StringLeft($sPath, StringInStr($sPath, "\", 0, -1)) $oDir = $oShellApp.NameSpace($sDir) $oFile = $oDir.Parsename($sFileName) For $i = 0 To 326 $sPropertyName = $oDir.GetDetailsOf("", $i) $aInfo[$i+1][0] = $i $aInfo[$i+1][1] = $sPropertyName Next _FileProperties(1) $sPath = "E:\Movies\다이하드\Die Hard 1990 1080p.mp4" $sFileName = StringMid($sPath, StringInStr($sPath, "\", 0, -1)+1) $sDir = StringLeft($sPath, StringInStr($sPath, "\", 0, -1)) $oDir = $oShellApp.NameSpace($sDir) $oFile = $oDir.Parsename($sFileName) _FileProperties(2) _ArrayDisplay($aInfo) $sFile = FileOpen("GetDetailsOf_Time_Comparison.csv", 2+32) FileWriteLine($sFile, "Index,Property Name,MP4 Property Value,MP4 Time,MKV Property Value,MKV Time") For $i = 1 To 328 $sLine = $aInfo[$i][0] & ',"' & $aInfo[$i][1] & '","' & $aInfo[$i][2] & '",' & $aInfo[$i][3] & ',"' & $aInfo[$i][4] & '",' & $aInfo[$i][5] FileWriteLine($sFile, $sLine) Next FileClose($sFile) Func _FileProperties($pass) Local $hh = TimerInit() For $i = 0 To 326 If $aInfo[$i+1][1] == "" Then ContinueLoop Local $h = TimerInit() $sPropertyValue = $oDir.GetDetailsOf($oFile, $i) If $pass = 1 Then $aInfo[$i+1][4] = $sPropertyValue $aInfo[$i+1][5] = TimerDiff($h) Else $aInfo[$i+1][2] = $sPropertyValue $aInfo[$i+1][3] = TimerDiff($h) EndIf Next If $pass = 1 Then $aInfo[328][5] = TimerDiff($hh) Else $aInfo[328][3] = TimerDiff($hh) EndIf EndFunc ;==>_FileProperties Below is the result in CSV format. Index,Property Name,MP4 Property Value,MP4 Time,MKV Property Value,MKV Time 0,"이름","Die Hard 1990 1080p.mp4",3.0631,"Die Hard 1990 1080p.mp4.mkv",7.8614 1,"크기","1.78GB",0.056,"1.78GB",0.0907 2,"항목 유형","MP4 Video File",0.9114,"Matroska Video File",0.9655 3,"수정한 날짜","2023-12-27 08:28",0.0372,"2023-12-27 08:28",1.337 4,"만든 날짜","2024-01-03 12:28",0.0784,"2023-12-27 08:25",0.0371 5,"액세스한 날짜","2024-01-03 12:29",0.0244,"2023-12-27 14:21",0.0334 6,"특성","AP",0.0149,"A",0.0217 7,"오프라인 상태","",76.4595,"",41.0655 8,"사용 가능성","",63.8677,"",9.7971 9,"인식 유형","비디오",73.8957,"비디오",11.7257 10,"소유자","DESKTOP-MAIN\CYCho",65.4929,"DESKTOP-MAIN\CYCho",12.2532 11,"종류","비디오",66.1417,"비디오",15.065 12,"찍은 날짜","",66.8936,"",13.582 13,"참여 음악가","",65.685,"",12.5167 14,"앨범","",72.008,"",10.0275 15,"연도","",66.7872,"",9.3085 16,"장르","",69.8391,"",10.0227 17,"지휘자","",69.3105,"",9.9945 18,"태그","",67.0479,"",9.9224 19,"등급","등급이 지정되지 않음",65.7666,"등급이 지정되지 않음",9.687 20,"만든 이","",73.1121,"",9.7518 21,"제목","",63.2458,"",9.5898 22,"주제","",60.7488,"",9.5796 23,"범주","",65.2308,"",9.5324 24,"설명","",70.6327,"",9.5423 25,"저작권","",74.6807,"",9.6648 26,"#","",65.9636,"",9.4747 27,"길이","02:03:21",70.2474,"02:03:21",9.5933 28,"비트 전송률","88kbps",68.7755,"88kbps",10.3432 29,"보호","아니요",63.4952,"",10.2576 30,"카메라 모델","",68.5612,"",9.8769 31,"사진 크기","",61.114,"",10.0885 32,"카메라 제조업체","",67.7801,"",10.2135 33,"회사","",69.3818,"",10.0224 34,"파일 설명","",68.4443,"",13.3698 35,"마스터 키워드","",63.794,"",12.7912 36,"마스터 키워드","",63.4306,"",10.1146 37,"","",,"", 38,"","",,"", 39,"","",,"", 40,"","",,"", 41,"","",,"", 42,"프로그램 이름","",64.002,"",11.4839 43,"지속 기간","",66.6222,"",9.3855 44,"온라인 상태","",71.5746,"",9.5498 45,"되풀이","",62.6805,"",9.1524 46,"위치","",65.7317,"",9.3323 47,"선택 참석자 주소","",63.5121,"",9.0928 48,"선택 참석자","",64.8234,"",9.3032 49,"이끌이 주소","",61.6177,"",9.2805 50,"이끌이 이름","",66.735,"",9.1113 51,"미리 알림 시간","",71.9525,"",9.4305 52,"필수 참석자 주소","",71.2276,"",9.3093 53,"필수 참석자","",67.5435,"",9.5913 54,"리소스","",66.1239,"",11.4626 55,"모임 상태","",61.9019,"",9.5407 56,"상태 표시","",65.3456,"",9.2457 57,"전체 크기","931GB",71.622,"931GB",9.4841 58,"계정 이름","",67.0149,"",9.1253 59,"","",,"", 60,"작업 상태","",63.4415,"",9.3919 61,"컴퓨터","DESKTOP-MAIN(이 PC)",67.8289,"DESKTOP-MAIN(이 PC)",10.5241 62,"기념일","",61.6693,"",9.9737 63,"비서 이름","",61.6833,"",9.4866 64,"비서 전화 번호","",63.7605,"",9.3556 65,"생일","",61.295,"",9.134 66,"근무처 주소","",68.8477,"",9.5392 67,"구/군/시(회사)","",61.6676,"",9.1888 68,"회사 국가/영역","",68.8696,"",9.5012 69,"회사 사서함","",68.3125,"",9.548 70,"우편 번호(회사)","",65.4922,"",9.4482 71,"회사 시/도","",62.4667,"",13.0864 72,"주소(회사)","",63.2268,"",9.5925 73,"회사 팩스","",70.9158,"",9.2095 74,"회사 홈 페이지","",68.9231,"",9.4724 75,"근무처 전화","",66.875,"",10.9388 76,"콜백 번호","",69.6263,"",9.5345 77,"카폰","",63.6595,"",9.4001 78,"자녀","",64.5019,"",10.8072 79,"회사 대표 전화","",62.3915,"",11.7146 80,"부서","",62.1256,"",9.389 81,"전자 메일","",72.4972,"",9.6485 82,"전자 메일2","",64.5475,"",9.5321 83,"전자 메일3","",65.3645,"",9.768 84,"전자 메일 목록","",69.7917,"",9.9103 85,"전자 메일 표시 이름","",65.0327,"",10.1346 86,"다음으로 파일","",63.3795,"",10.2868 87,"연락처 이름","",63.3803,"",10.0825 88,"전체 이름","",65.1382,"",10.0032 89,"성별","",65.8866,"",9.9956 90,"연락처 이름","",75.4915,"",10.1797 91,"취미","",65.7989,"",10.201 92,"집 주소","",62.6339,"",9.4476 93,"구/군/시(집)","",70.9951,"",11.1712 94,"집 국가/영역","",63.4265,"",9.9033 95,"집 사서함","",70.5791,"",11.1873 96,"우편 번호(집)","",64.2293,"",10.7294 97,"집 시/도","",63.6011,"",9.5518 98,"주소(집)","",68.3227,"",9.2741 99,"집 팩스","",66.0305,"",11.5422 100,"집 전화","",63.5334,"",10.0834 101,"IM 주소","",70.2093,"",10.3911 102,"이니셜","",66.4064,"",11.3268 103,"직함","",61.9372,"",10.2147 104,"레이블","",69.6138,"",9.763 105,"성","",61.2334,"",9.4688 106,"우편 주소","",64.0243,"",9.4355 107,"중간 이름","",67.2798,"",9.1791 108,"이동 전화","",73.4792,"",11.5796 109,"애칭","",62.7271,"",9.513 110,"사무실 위치","",66.4542,"",9.1749 111,"기타 주소","",66.2637,"",11.3687 112,"다른 도시","",71.218,"",9.3352 113,"다른 국가/지역","",61.4879,"",9.1717 114,"다른 사서함","",69.9389,"",9.5329 115,"다른 우편 번호","",64.1962,"",10.0145 116,"다른 시/도","",67.5299,"",10.7699 117,"다른 주소","",73.5658,"",9.2538 118,"호출기","",66.3716,"",9.6562 119,"영문 호칭","",64.1731,"",11.1321 120,"구/군/시","",70.7043,"",9.5631 121,"국가/지역","",69.3363,"",9.3379 122,"사서함","",65.442,"",9.2061 123,"우편 번호","",63.5363,"",9.2782 124,"시/도","",70.5661,"",9.1407 125,"주소","",69.8573,"",9.1968 126,"기본 전자 메일 주소","",64.4557,"",9.2992 127,"기본 전화","",63.855,"",9.137 128,"직업","",65.9622,"",9.4307 129,"배우자/파트너","",63.5273,"",9.1886 130,"접미사","",68.0115,"",9.4191 131,"TTY/TTD 전화","",64.1319,"",9.3816 132,"텔렉스","",71.4298,"",9.4641 133,"웹 페이지","",64.1562,"",11.552 134,"콘텐츠 상태","",64.4208,"",9.2983 135,"콘텐츠 형식","",70.8671,"",9.3537 136,"취득한 날짜","",62.0448,"",11.2232 137,"보관된 날짜","",61.3057,"",10.6195 138,"완료 날짜","",63.9444,"",11.0514 139,"장치 범주","",62.7956,"",9.3071 140,"연결됨","",65.9427,"",9.3251 141,"검색 방법","",68.3272,"",9.1541 142,"이름","",61.1547,"",11.5516 143,"로컬 컴퓨터","",65.5262,"",9.3145 144,"제조업체","",61.3745,"",9.1114 145,"모델","",67.2367,"",11.4738 146,"쌍으로 연결됨","",63.2704,"",10.8106 147,"분류","",64.8881,"",9.4152 148,"상태","",62.1156,"",9.5486 149,"상태","",69.7845,"",9.4084 150,"클라이언트 ID","",66.0062,"",9.2375 151,"도와주신 분들","",72.9267,"",11.4985 152,"콘텐츠 작성 날짜","",63.4297,"",10.6301 153,"마지막으로 인쇄한 날짜","",63.8918,"",9.7706 154,"마지막으로 저장한 날짜","",70.3922,"",9.514 155,"국(부서)","",65.296,"",9.4799 156,"문서 ID","",63.3009,"",9.1663 157,"페이지","",69.7306,"",9.4904 158,"슬라이드","",64.1981,"",10.0827 159,"총 편집 시간","",68.7433,"",10.5364 160,"단어 수","",63.4717,"",9.254 161,"기한","",66.0095,"",9.6836 162,"끝 날짜","",62.7865,"",10.7244 163,"파일 수","",60.9437,"",9.2977 164,"파일 확장명",".mp4",61.3148,".mkv",9.1845 165,"파일 이름","Die Hard 1990 1080p.mp4",60.8845,"Die Hard 1990 1080p.mp4.mkv",9.711 166,"파일 버전","",69.354,"",11.0528 167,"플래그 색","",66.155,"",9.9178 168,"플래그 상태","",70.6768,"",10.5646 169,"사용 가능한 공간","102GB",65.3372,"102GB",10.8464 170,"","",,"", 171,"","",,"", 172,"그룹","",68.2991,"",9.9193 173,"공유 유형","",68.85,"",9.6184 174,"비트 수준","",66.3164,"",9.5241 175,"수평 해상도","",66.7444,"",9.3398 176,"너비","",67.6489,"",9.7862 177,"수직 해상도","",64.9049,"",11.481 178,"높이","",68.7388,"",9.74 179,"중요도","",68.1132,"",11.3455 180,"첨부 파일임","",61.2173,"",9.6144 181,"삭제됨","",63.3175,"",10.0681 182,"암호화 상태","",63.9474,"",10.2945 183,"플래그 있음","",70.6822,"",9.2647 184,"완료됨","",66.7306,"",9.6512 185,"완료 안 됨","",62.4843,"",10.7295 186,"읽음 상태","",64.9979,"",12.3298 187,"공유됨","아니요",67.7799,"아니요",21.4677 188,"작성자","",64.4937,"",9.2522 189,"날짜","",67.9154,"",9.3224 190,"폴더 이름","다이하드",74.3761,"다이하드",9.2371 191,"파일 위치","E:\Movies\다이하드",66.5978,"E:\Movies\다이하드",9.289 192,"폴더","다이하드(E:\Movies)",68.5235,"다이하드(E:\Movies)",9.3764 193,"참가자","",66.4261,"",9.1438 194,"경로","E:\Movies\다이하드\Die Hard 1990 1080p.mp4",69.6194,"E:\Movies\다이하드\Die Hard 1990 1080p.mp4.mkv",11.6428 195,"위치별","",66.0242,"",9.4489 196,"유형","MP4 Video File",65.454,"Matroska Video File",9.5248 197,"연락처","",67.2693,"",11.4546 198,"저널 항목 유형","",64.139,"",10.3201 199,"언어","",65.5853,"",10.2308 200,"열어본 날짜","",65.0431,"",11.7812 201,"주석","",73.8948,"",11.4894 202,"연결 상태","해결되지 않음",65.8393,"해결되지 않음",9.5095 203,"링크 대상","",66.2288,"",9.262 204,"URL","",72.316,"",9.3306 205,"","",,"", 206,"","",,"", 207,"","",,"", 208,"미디어 작성 날짜","2012-09-08 02:05",66.9502,"2012-09-08 03:05",9.2127 209,"릴리스 날짜","",66.023,"",9.3105 210,"인코딩한 사람","",68.6279,"",9.2729 211,"에피소드 번호","",63.129,"",9.144 212,"제작자","",64.798,"",9.3502 213,"게시자","",65.8145,"",9.3358 214,"시즌 번호","",61.0541,"",11.2713 215,"자막","",69.4433,"",10.9902 216,"사용자 웹 URL","",65.3315,"",9.3713 217,"작사가","",70.5091,"",9.2218 218,"","",,"", 219,"첨부 파일들","",72.4973,"",11.5857 220,"숨은 참조 주소","",64.2834,"",10.3279 221,"숨은 참조","",68.7803,"",10.6102 222,"참조 주소","",66.3922,"",10.2814 223,"참조","",71.0713,"",9.3916 224,"대화 ID","",68.4893,"",9.5443 225,"받은 날짜","",66.8852,"",9.6008 226,"보낸 날짜","",66.3187,"",9.9353 227,"보낸 사람 주소","",63.5641,"",9.8016 228,"보낸 사람","",64.1802,"",9.7825 229,"첨부 파일 있음","",72.2602,"",9.8196 230,"발신자 주소","",71.1541,"",11.0937 231,"발신자 이름","",64.1907,"",11.4096 232,"저장소","",68.853,"",9.6478 233,"받는 사람 주소","",64.8478,"",9.4361 234,"할 일 제목","",61.4642,"",9.506 235,"받는 사람","",68.6809,"",9.4074 236,"진행 정도","",64.3285,"",9.4651 237,"앨범 음악가","",62.7039,"",9.5955 238,"앨범 음악가 정렬","",72.1842,"",9.4843 239,"앨범 ID","",68.0971,"",9.6631 240,"앨범 정렬","",62.301,"",9.6007 241,"참여 음악가 정렬","",68.5039,"",9.4862 242,"분당 비트 수","",67.1253,"",9.2863 243,"작곡가","",65.5905,"",9.2626 244,"작곡가 정렬","",63.1017,"",9.1265 245,"디스크","",65.9176,"",9.3124 246,"초기 키","",65.2333,"",9.1561 247,"컴파일의 일부","",63.4994,"",9.3699 248,"분위기","",64.5523,"",9.2429 249,"집합의 일부","",62.0423,"",9.1361 250,"기간","",71.5526,"",9.4293 251,"색","",69.6342,"",9.5343 252,"자녀 보호 등급","",73.7988,"",10.8649 253,"자녀 보호 등급 근거","",68.6094,"",9.6855 254,"사용된 공간","89%",60.7829,"89%",9.8941 255,"EXIF 버전","",62.1634,"",9.6183 256,"이벤트","",73.6646,"",9.7706 257,"노출 바이어스","",64.7031,"",9.4198 258,"노출 프로그램","",62.6725,"",9.3935 259,"노출 시간","",68.2474,"",9.3458 260,"F-스톱","",63.0021,"",9.1225 261,"플래시 모드","",62.6467,"",11.4244 262,"초점 거리","",65.9691,"",9.4339 263,"35mm 초점 거리","",64.0305,"",9.0988 264,"ISO 감도","",65.4129,"",9.2702 265,"렌즈 제조업체","",74.9223,"",9.2294 266,"렌즈 모델","",63.7962,"",9.1861 267,"광원","",70.8937,"",9.5745 268,"조리개 최대 개방","",74.8533,"",9.144 269,"측광 모드","",66.952,"",11.31 270,"방향","",67.8962,"",11.2443 271,"피플","",66.3064,"",11.5814 272,"프로그램 모드","",66.5268,"",9.3333 273,"채도","",63.0115,"",9.7355 274,"피사체 거리","",68.4801,"",9.3938 275,"화이트 밸런스","",65.3569,"",9.2068 276,"우선 순위","",62.4139,"",9.3184 277,"프로젝트","",68.227,"",9.0864 278,"채널 번호","",62.3944,"",9.3021 279,"에피소드 이름","",69.9127,"",9.3273 280,"자막","",69.995,"",9.1345 281,"다시 실행","",61.2097,"",9.2985 282,"SAP","",70.7932,"",9.104 283,"브로드캐스트 날짜","",65.1338,"",11.1369 284,"프로그램 설명","",70.7243,"",9.322 285,"녹음/녹화 시간","",68.6934,"",9.0625 286,"방송국 호출 부호","",72.4872,"",9.3028 287,"방송국 이름","",65.0355,"",9.3085 288,"요약","",67.6469,"",9.0658 289,"짧은 요약","",68.2816,"",9.2817 290,"자동 요약","",70.7561,"",9.0439 291,"정확도","",62.8296,"",9.5115 292,"파일 소유권","",62.8391,"",9.2063 293,"우편물 종류","",70.4059,"",9.069 294,"공유 사용자","",72.594,"",12.7789 295,"공유 상태","공유 안 됨",71.584,"공유 안 됨",12.1245 296,"","",,"", 297,"제품 이름","",64.9751,"",9.3411 298,"제품 버전","",75.2943,"",9.4842 299,"지원 링크","",63.3756,"",9.6396 300,"원본","",64.8945,"",9.2387 301,"시작 날짜","",65.6941,"",9.4464 302,"공유","",67.4388,"",10.7705 303,"가용성 상태","",67.8588,"",10.1281 304,"상태","",71.6115,"",13.4537 305,"대금 청구 정보","",63.4004,"",9.4688 306,"완료","",72.9123,"",9.3607 307,"작업 소유자","",73.4447,"",9.1814 308,"제목 정렬","",74.4474,"",9.2437 309,"전체 파일 크기","",66.2521,"",9.1478 310,"등록 상표","",63.836,"",9.5705 311,"비디오 압축","{34363248-0000-0010-8000-00AA00389B71}",65.3131,"",10.0136 312,"감독","",61.5243,"",9.9249 313,"데이터 속도","1982kbps",65.1799,"1982kbps",9.3746 314,"프레임 높이","812",64.5847,"812",9.3505 315,"프레임 속도","23.98 프레임/초",65.8575,"23.98 프레임/초",9.0811 316,"프레임 너비","1920",62.4838,"1920",11.3384 317,"구면","아니요",65.2535,"",9.3673 318,"스테레오","아니요",66.1184,"",9.0702 319,"비디오 방향","0",64.9827,"",9.3539 320,"총 비트 전송률","2071kbps",62.7506,"2071kbps",9.1045 321,"Audio tracks","",64.2929,"AAC 2.0",9.609 322,"Bit depth","",70.1327,"",9.4931 323,"Contains chapters","",65.6889,"",9.1074 324,"Content compression","",61.8522,"",9.3283 325,"Subtitles","",70.0341,"",9.3835 326,"Subtitle tracks","",68.8548,"",9.1669 ,"","",20445.7826,"",3096.7007 FYI, MKV file is the exact copy of MP4 file with ".mkv" added in the file name. As you can see, an MP4 file takes much more time for the simple reason that its extension is MP4. It may have something to do with the CPU clock speed. Mine is AMD Ryzen 5 3400G with Radeon Vega Graphics, 3.70 GHz. Conclusion: As major chunk of time is spent to obtain empty or useless property values, I decided to query only about 25 items, thus shortening the time to about 250 ms (1.5 seconds even for a large MP4 file). I can live with that. One thing I feel uncomfortable is that the index numbers I use in Windows 10 and 11 may not work in older versions of Windows. For example, I use index number 27 to get media length, but I am not sure if 27 is valid under Windows Vista. At least I learned something valuable during the last couple of days. Thank you all for your inputs.2 points -
@ioa747 Good catch, should have thought of it myself @mike1950r Yes it should work for you very well, lmk how it goes1 point
-
Edit box not cleared after first click
littlebigman reacted to Nine for a topic
Yes I figured that was you were thinking. And the code you showed is exactly what I meant.1 point -
Edit box not cleared after first click
littlebigman reacted to ioa747 for a topic
For $iI = 1 To $aItems[0] $sItems &= $aItems[$iI] & @CRLF Next1 point -
Edit box not cleared after first click
littlebigman reacted to Nine for a topic
Because $sItems is not reset to "" ps. You should not declare your variables inside loop (or any other block). It doesn't cause bugs, but you may misinterpret what it is doing (and it is not amongst best practices).1 point -
try Run('"explorer.exe" "C:\Windows\system32\dsa.msc"')1 point
-
Simply because that file is not an executable! ShellExecute() is using the command shell to open the file with the default defined application for file extension msc. Run() will work when you define it like: Run(@comspec & " /c C:\Windows\system32\dsa.msc");1 point
-
_ImageSearch_Area($_ImagePath, $P_x1 = 0, $P_y1 = 0, $P_x2 = @DesktopWidth, $P_y2 = @DesktopHeight, $_Tolerance = 0, $_CenterPos = True) If you're not getting the expected results with your image search, it could be due to the images not being exactly the same as those on your desktop. This is where the Tolerance parameter comes into play. The Tolerance parameter in the _ImageSearch_Area function allows for some degree of inaccuracy in the image matching process. Essentially, a higher Tolerance value means the function can still find a match even if the image isn't a perfect match to the one you're looking for. This can be particularly useful if the image on the screen might change slightly in appearance due to factors like scaling, resolution differences, or minor color variations. For instance, if you set $_Tolerance to a value greater than 0 (like 10 or 20), the function will tolerate more differences between the searched image and the images on the screen. This could potentially solve the issue if the reason for not finding the image is due to minor discrepancies. In summary, if your image isn't being found because it's not 100% identical to the one on your desktop, adjusting the Tolerance value might help the _ImageSearch_Area function to find a close, if not exact, match. but that's just a guess.1 point
-
I use this in SMF which doesn't require admin access. Not quite sure, but I think @trancexx provided a lot to this code. #include <array.au3> #include <WinAPI.au3> $h_DLL_Kernel32 = DllOpen("kernel32.dll") $aData = _Drive_GetHardwareInfos_SMF("c") _ArrayDisplay($aData) Func _Drive_GetHardwareInfos_SMF($DriveLetter) Local $a_Info_Drive_Hardware_temp[4] Local $ret, $tTemp, $ptrTemp $ret = DllCall($h_DLL_Kernel32, 'ptr', 'CreateFileW', _ 'wStr', '\\.\' & $DriveLetter & ':', _ 'dword', 0, _ 'dword', 7, _ 'ptr', 0, _ 'dword', 3, _ 'dword', 0, _ 'ptr', 0 _ ) If @error Then Return SetError(1, 0, $a_Info_Drive_Hardware_temp) If $ret[0] = 0xFFFFFFFF Then Return SetError(2, 0, $a_Info_Drive_Hardware_temp) Local $hDevice = $ret[0] Local Const $tagSTORAGE_PROPERTY_QUERY = 'ULONG_PTR PropertyId;ULONG_PTR QueryType;byte AdditionalParameters[4]' Local Const $tagSTORAGE_DESCRIPTOR_HEADER = 'ulong Version;ulong Size' Local $tSTORAGE_PROPERTY_QUERY = DllStructCreate($tagSTORAGE_PROPERTY_QUERY) DllStructSetData($tSTORAGE_PROPERTY_QUERY, 'PropertyId', 0) DllStructSetData($tSTORAGE_PROPERTY_QUERY, 'QueryType', 0) Local $tSTORAGE_DESCRIPTOR_HEADER = DllStructCreate($tagSTORAGE_DESCRIPTOR_HEADER) ; IOCTL_STORAGE_QUERY_PROPERTY = 0x002d1400 $ret = DllCall($h_DLL_Kernel32, 'int', 'DeviceIoControl', _ 'handle', $hDevice, _ 'dword', 0x002D1400, _ 'ptr', DllStructGetPtr($tSTORAGE_PROPERTY_QUERY), _ 'dword', DllStructGetSize($tSTORAGE_PROPERTY_QUERY), _ 'PTR', DllStructGetPtr($tSTORAGE_DESCRIPTOR_HEADER), _ 'dword', DllStructGetSize($tSTORAGE_DESCRIPTOR_HEADER), _ 'dword*', 0, _ 'ptr', 0 _ ) If DllStructGetData($tSTORAGE_DESCRIPTOR_HEADER, "Size") Then ; https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddstor/ns-ntddstor-_storage_device_descriptor Local Const $tagSTORAGE_DEVICE_DESCRIPTOR = 'ulong Version;ulong Size;char DeviceType;char DeviceTypeModifier;byte RemovableMedia;byte CommandQueueing;ulong VendorIdOffset;ulong ProductIdOffset;ulong ProductRevisionOffset;ulong SerialNumberOffset;ulong BusType;ulong RawPropertiesLength;byte RawDeviceProperties[' & DllStructGetData($tSTORAGE_DESCRIPTOR_HEADER, "Size") & ']' Local $tSTORAGE_DEVICE_DESCRIPTOR = DllStructCreate($tagSTORAGE_DEVICE_DESCRIPTOR) $ret = DllCall($h_DLL_Kernel32, 'int', 'DeviceIoControl', _ 'handle', $hDevice, _ 'dword', 0x002D1400, _ 'PTR', DllStructGetPtr($tSTORAGE_PROPERTY_QUERY), _ 'dword', DllStructGetSize($tSTORAGE_PROPERTY_QUERY), _ 'PTR', DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR), _ 'dword', DllStructGetSize($tSTORAGE_DEVICE_DESCRIPTOR), _ 'dword*', 0, _ 'PTR', 0 _ ) ;ConsoleWrite("VendorIdOffset " & DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "VendorIdOffset") & @CRLF) If DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "VendorIdOffset") Then $ptrTemp = DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR) + DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "VendorIdOffset") $tTemp = DllStructCreate("char Temp[" & _WinAPI_StringLenA($ptrTemp) & "]", $ptrTemp) $a_Info_Drive_Hardware_temp[0] = DllStructGetData($tTemp, "Temp") ; ConsoleWrite($a_Info_Drive_Hardware_temp[0] & @CRLF) EndIf ;ConsoleWrite("ProductIdOffset " & DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductIdOffset") & @CRLF) If DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductIdOffset") Then $ptrTemp = DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR) + DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductIdOffset") $tTemp = DllStructCreate("char Temp[" & _WinAPI_StringLenA($ptrTemp) & "]", $ptrTemp) $a_Info_Drive_Hardware_temp[1] = DllStructGetData($tTemp, "Temp") ; ConsoleWrite($a_Info_Drive_Hardware_temp[1] & @CRLF) EndIf ;ConsoleWrite("ProductRevisionOffset " & DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductRevisionOffset") & @CRLF) If DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductRevisionOffset") Then $ptrTemp = DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR) + DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductRevisionOffset") $tTemp = DllStructCreate("char Temp[" & _WinAPI_StringLenA($ptrTemp) & "]", $ptrTemp) $a_Info_Drive_Hardware_temp[2] = DllStructGetData($tTemp, "Temp") ; ConsoleWrite($a_Info_Drive_Hardware_temp[2] & @CRLF) EndIf ;ConsoleWrite("SerialNumberOffset " & DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "SerialNumberOffset") & @CRLF) If "0x" & Hex(DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "SerialNumberOffset")) <> "0xFFFFFFFF" Then $ptrTemp = DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR) + DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "SerialNumberOffset") $tTemp = DllStructCreate("char Temp[" & _WinAPI_StringLenA($ptrTemp) & "]", $ptrTemp) $a_Info_Drive_Hardware_temp[3] = DllStructGetData($tTemp, "Temp") ; ConsoleWrite($a_Info_Drive_Hardware_temp[3] & @CRLF) EndIf EndIf $a_Info_Drive_Hardware_temp[0] = _StringToReadable($a_Info_Drive_Hardware_temp[0]) $a_Info_Drive_Hardware_temp[1] = _StringToReadable($a_Info_Drive_Hardware_temp[1]) $a_Info_Drive_Hardware_temp[2] = _StringToReadable($a_Info_Drive_Hardware_temp[2]) $a_Info_Drive_Hardware_temp[3] = _SwapStringOrder(_StringToReadable($a_Info_Drive_Hardware_temp[3])) DllCall($h_DLL_Kernel32, 'int', 'CloseHandle', 'hwnd', $hDevice) Return $a_Info_Drive_Hardware_temp EndFunc ;==>_Drive_GetHardwareInfos_SMF Func _StringToReadable($sString) Local $sString_Return, $iAscCode Local $aString = StringSplit($sString, "") For $i = 1 To $aString[0] $iAscCode = Asc($aString[$i]) Switch $iAscCode ; Case 32 to 126 Case 32, 48 To 57, 65 To 90, 97 To 122 $sString_Return &= $aString[$i] EndSwitch Next Return $sString_Return EndFunc ;==>_StringToReadable Func _SwapStringOrder($sString) Local $sString_Return, $iAscCode ; ConsoleWrite($sString & @TAB & StringLen($sString) & @CRLF) Local $aString = StringSplit($sString, "") For $i = 1 To $aString[0] Step 2 If $i + 1 > $aString[0] Then $sString_Return &= $aString[$i] ExitLoop EndIf $sString_Return &= $aString[$i + 1] & $aString[$i] ; ConsoleWrite($i & @TAB & $aString[0] & @CRLF) Next Return $sString_Return EndFunc ;==>_SwapStringOrder1 point