Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.47 MB
Время: 0.021 c
1-1100509707
denis24
2004-11-15 12:08
2004.11.28
Как проверить ,есть картинка в Iimage?


14-1100026374
Valentina
2004-11-09 21:52
2004.11.28
программа "Тест"


11-1082976944
nester
2004-04-26 14:55
2004.11.28
А куда делся OnException?


1-1100384780
Змей
2004-11-14 01:26
2004.11.28
Popupmenu


3-1099223103
Hyboid
2004-10-31 14:45
2004.11.28
Вставка в базу




   Наверх