Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

Местонахождение \WINDOWS\SYSTEM32\DRIVERS [D7, Win95/98, WinXP]


Leaner ©   (2004-10-15 15:32:00) 

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


InfMag   (2004-10-16 16:40:00) [1]

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


GuAV   (2004-10-16 02:23:00) [2]

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


GanibalLector   (2004-10-16 02:18:00) [3]

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


GanibalLector   (2004-10-16 02:13:00) [4]

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


GuAV   (2004-10-15 23:56:00) [5]


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

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


GanibalLector   (2004-10-15 20:14:00) [6]

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


clickmaker   (2004-10-15 17:54:00) [7]

GetSystemDirectory()  + '\DRIVERS'


Leaner   (2004-10-15 15:58:00) [8]

Проблеммы:
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"


Leaner   (2004-10-15 15:43:00) [9]

>antonn
Спасибо !


antonn   (2004-10-15 15:37:00) [10]

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;


Наверх

Титульная страница Поиск, карта сайта Написать письмо