Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.11.28;
Скачать: CL | DM;

Вниз

Местонахождение 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 вся ветка

Текущий архив: 2004.11.28;
Скачать: CL | DM;

Наверх




Память: 0.49 MB
Время: 0.045 c
1-1100085884
chuk
2004-11-10 14:24
2004.11.28
запись в файл, ошибка


4-1097591069
#Мастер#
2004-10-12 18:24
2004.11.28
Скины


11-1082847860
nsvi
2004-04-25 03:04
2004.11.28
KOLTreeView - цвет шрифта элементов дерева


1-1100268469
denis24
2004-11-12 17:07
2004.11.28
Изменения цвета окон встроенных диалогов


1-1099647626
TankMan
2004-11-05 12:40
2004.11.28
Ни кто не видал ListBox(или аналог), в котором реалезована