perl et win32::api (fonctions windows)
Bonjour,
Je ne sais pas si il y a un grand guru du perl qui a qq notions en C sur ce forum mais sinon j'aurai besoin d'un peu (beaucoup) d'aide pour
pouvoir mettre en oeuvre les fonctions "SHSetKnownFolderPath" et "SHChangeNotify" (pour pouvoir rediriger partiellement le profil utilisateur).
http://msdn.microsoft.com/en-us/libr...49(VS.85).aspx
Code:
1 2 3 4 5 6 7
|
HRESULT SHSetKnownFolderPath(
__in REFKNOWNFOLDERID rfid,
__in DWORD dwFlags,
__in HANDLE hToken,
__in PCWSTR pszPath
); |
http://msdn.microsoft.com/en-us/libr...18(VS.85).aspx
Code:
1 2 3 4 5 6 7
|
void SHChangeNotify(
LONG wEventId,
UINT uFlags,
__in_opt LPCVOID dwItem1,
__in_opt LPCVOID dwItem2
); |
Voici 1 exemple concret en C :
http://social.msdn.microsoft.com/For...7-fa1faea3fbbd
J'ai testé un autre exemple en autoit mais cette fois ci avec la fonction SHGetKnownFolderPath :
http://www.autoitscript.com/forum/to...ost__p__489845
* on trouve beaucoup d'exemples de fonctions implémentées via "autoit" (du coup ça renseigne sur les types, structures et constantes).
Pour obtenir le "REFKNOWNFOLDERID", il faut utiliser la fonction "CLSIDFromString" :
Code:
1 2 3 4 5
|
HRESULT CLSIDFromString(
LPOLESTR lpsz,
LPCLSID pclsid
); |
Le pointeur "pclsid" référence à priori une structure du type 'lssC8' (j'ai traduit d'autoit en perl pack) :
http://www.autoitscript.com/autoit3/...s/$tagGUID.htm
http://www.autoitscript.com/autoit3/...ructCreate.htm
http://perldoc.perl.org/functions/pack.html
Du coup, pour l'instant j'en suis là (mais je n'arrive pas à récupérer le clsid) :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
use strict;
use Win32;
use Win32::API;
$Win32::API::DEBUG = 1;
# intialisation du pointeur
my $pclsid = pack ('lssC8', "x\00" );
# initialisation de la fonction
my $CLSIDFromString = new Win32::API("Ole32", 'CLSIDFromString', 'NP', 'N') || die;
# appel de la fonction
$CLSIDFromString->Call('{4BD8D571-6D19-48D3-BE97-422220080E43}', $pclsid ); |
Merci d'avance pour votre aide !!!