Projet

Général

Profil

Feature - Fonctionnalité #4752

Feature - Fonctionnalité #4747: WebDav deuxième montage si on est derrière servecole

Webdav api windows

Ajouté par Icham Sirat il y a environ 8 ans. Mis à jour il y a environ 8 ans.

Statut:
Assigned - En cours
Priorité:
Normale
Assigné à:
Icham Sirat
Version cible:
Début:
11/03/2016
Echéance:
% réalisé:

20%


Description

Essaye de passer par la dll NetApi32 popur créer le point de montage.

Historique

#1 Mis à jour par Icham Sirat il y a environ 8 ans

  • % réalisé changé de 0 à 20
      QString drive = "E:";
        LMSTR str_drive = (wchar_t*) drive.utf16();
        QString remote = "\\\\192.168.100.1\\tmp";
        LMSTR str_remote= (wchar_t*) remote.utf16();
        qDebug() << remote << str_remote;
        QString password = "";
        LMSTR str_password = (wchar_t*) password.utf16();

        QString username = "";
        LMSTR str_username = (wchar_t*) username.utf16();
        QString domain = "";
        LMSTR str_domain = (wchar_t*) domain.utf16();

        USE_INFO_2 useInfo;
        useInfo.ui2_local     = str_drive;
        useInfo.ui2_remote    = str_remote;
        useInfo.ui2_password  = str_password;
        useInfo.ui2_asg_type  = 0;    //disk drive
        useInfo.ui2_usecount  = 1;
        useInfo.ui2_username  = str_username;
        useInfo.ui2_domainname= str_domain;

        DWORD paramErrorIndex;

        DWORD returnCode = NetUseAdd(NULL, 2, (LPBYTE) &useInfo, &paramErrorIndex);
        if (returnCode != 0)
        {
            qDebug() << "KO" << paramErrorIndex << returnCode;
        }

Le code fonctionne mais ne rajoute pas de lecteur dans l'explorateur Windows.
Il est seulement visible avec la commande

net use
.

Je continue.

#2 Mis à jour par Icham Sirat il y a environ 8 ans

D'après mes premières recherches le mappage réseau devrait être visible :

NetUseAdd() makes the connection visible in Windows Explorer, while WNetUseConnection() and WNetAddConnection() do not make the connection visible in Windows Explorer.

#3 Mis à jour par Icham Sirat il y a environ 8 ans

BAh je viens de trouver le contraire sur msdev :

Welcome to MSDN Forum Support.
The UNCAccessWithCredentials class implements the Win32 methods
NetUseAdd() and NetUseDel() to create the remote connections. Connections added with
NetUseAdd are not visible in Explorer. When active, they will show via the DOS
Net Use command. You can read this article named
Connect to a UNC Path with Credentials.
MSDN Community Support

En utilisant un process lançant "net use", on l'a bien dans l'explorer..

GRR

Formats disponibles : Atom PDF

Redmine Appliance - Powered by TurnKey Linux