Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2004.11.28;
Скачать: [xml.tar.bz2];

Вниз

Местонахождение WINDOWS SYSTEM32 DRIVERS   Найти похожие ветки 

 
Leaner ©   (2004-10-15 15:32) [0]

Здравствуйте !
Подскажите, пожалуйста, как определить
директорию, в которой находяться
драйвера (\WINDOWS\SYSTEM32\DRIVERS)?


 
antonn ©   (2004-10-15 15:37) [1]

uses ActiveX, ShlObj;

function TDirectorys.SpecialDir(Spec:integer):string;
var
 Allocator: IMalloc;
 SpecialDir: PItemIdList;
 FBuf: array[0..MAX_PATH] of Char;
 PerDir: string;
begin
 if SHGetMalloc(Allocator) = NOERROR then
 begin
   SHGetSpecialFolderLocation(application.Handle,  spec , SpecialDir);
   SHGetPathFromIDList(SpecialDir, @FBuf[0]);
   Allocator.Free(SpecialDir);
   result:=string(FBuf);
 end;
end;

function TDirectorys.DRIVES:string;
begin
result:=SpecialDir(CSIDL_DRIVES);
end;


 
Leaner ©   (2004-10-15 15:43) [2]

>antonn
Спасибо !


 
Leaner ©   (2004-10-15 15:58) [3]

Проблеммы:
SpecialDir(CSIDL_DRIVES) выдает пустую строку.
И я в хелпе натолкнулся на следующее:
"the following special folders are pure virtual and cannot be mapped to a directory path:
CSIDL_INTERNET, CSIDL_CONTROLS, CSIDL_PRINTERS,  CSIDL_BITBUCKET, CSIDL_DRIVES
CSIDL_NETWORK, CSIDL_ALTSTARTUP, CSIDL_COMMON_ALTSTARTUP"


 
clickmaker ©   (2004-10-15 17:54) [4]

GetSystemDirectory()  + "\DRIVERS"


 
GanibalLector ©   (2004-10-15 20:14) [5]

2 clickmaker
Слегка расширю :
GetSystemDirectory(QQ,GetSystemDirectory(nil,0))


 
GuAV ©   (2004-10-15 23:56) [6]


> GetSystemDirectory(QQ,GetSystemDirectory(nil,0))

Имхо лучше так
I:=GetSystemDirectory(nil,0));
SetLength(S, I-1);
GetSystemDirectory(PChar(S),I))


 
GanibalLector ©   (2004-10-16 02:13) [7]

2 GuAV
SetLength(S, I-1);
А не плюс ли там???Почему минус,мотивируйте!!!


 
GanibalLector ©   (2004-10-16 02:18) [8]

2 GuAV
Пардон...Осознал!


 
GuAV ©   (2004-10-16 02:23) [9]

GetSystemDirectory

...

Return Values

If the function succeeds, the return value is the length, in characters, of the string copied to the buffer, not including the terminating null character.

/* наш случай: */
If the length is greater than the size of the buffer, the return value is the size of the buffer required to hold the path.
/* надо полагать, including the terminating null  */


В AnsiString включён Null-terminator, его позиция = длина_строки + 1
т.е. -1 мы делаем not including the terminating null character


 
InfMag ©   (2004-10-16 16:40) [10]

Хм. Я обычно вычитываю строчки из реестра, чтобы определить сис. пути...



Страницы: 1 вся ветка

Форум: "WinAPI";
Текущий архив: 2004.11.28;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.032 c
14-1099994364
Drakosha
2004-11-09 12:59
2004.11.28
Opera и Isa2004


3-1098891213
AlexGof
2004-10-27 19:33
2004.11.28
Как сохранить файл (например word или exel) в БД ?


1-1100192842
novice_man
2004-11-11 20:07
2004.11.28
Access violation at adress ...


8-1094074341
zero-g
2004-09-02 01:32
2004.11.28
Строка состояния в видео проигрывателе


8-1094032671
X-Disa
2004-09-01 13:57
2004.11.28
Скроллбары в TImgView32





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский