Autor Beitrag
blaskito
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63

Win2003, 2008, 2012, WinXP, Win7
Delphi 6 Pers.
BeitragVerfasst: Di 07.04.09 14:10 
Hallo Leute,

ich habe ein kleines Tool gebastelt, dass mir von PCs in meinem Netz z.B. die installierte Software ausliest oder Dateien auf die Rechner kopiert. In der Domäne in der mein PC hängt ist das auch kein Problem und funktioniert wunderbar. Nun liegen aber insgesamt 3 Domänen in meinem Netz und es gelingt mir nicht, über die Domänengrenzen hinweg auf die Registry und/oder das File System zuzugreifen. Ich muss halt auf 3 PCs - also in jeder Domäne einen - zurückgreifen.

Ich habe gelesen, dass ich mich für das was ich will ja einfach nur mit Adminrechten an der Registrierung oder einer administrativen Freigabe anmelden muss. Leider habe ich nicht die geringste Ahnung, wie ich genau das anstellen soll.

Ich gehe mal davon aus, dass das mehr ein Problem der Win-API ist und nicht des Internet-/Netzwerkbereiches. Kann mir jemand einen Tip geben, wo ich den Hebel ansetzen kann?

Schöne Grüße aus dem sonnigen Norden
blaskito
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 07.04.09 14:30 
Du musst dich an der fremden Domäne mit deinem Rechner Authentifizieren (WNet*-API IIRC) und dann erst versuchen zuzugreifen. Glaube Luckie hatte dazu mal was auf seiner Page.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
blaskito Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63

Win2003, 2008, 2012, WinXP, Win7
Delphi 6 Pers.
BeitragVerfasst: Di 07.04.09 16:00 
Ich habe bei Luckie schon gesucht aber leider nix passendes gefunden. Verstehe ich dich richtig, dass ich nicht den Benutzer sondern den PC anmelden muss?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 07.04.09 16:50 
Windows kann zu jedem Rechner immer nur eine Authentifizierte Sitzung aufbauen (AFAIK), was man nicht zuletzt an der Dateifreigabe sieht (und diesen netten Meldungen, wenn Windows sich als Gast angemeldet hat, man aber auf eine User-Geschützte Freigabe muss und daher den User zusätzlich anmelden will).

Ob Du dich nun als Computer oder als User am entfernten Rechner anmeldest dürfte IMHO egal sein, solange eine Sitzung vorhanden ist, die ausreichend Rechte für die auszuführenden Aktionen hat.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
blaskito Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63

Win2003, 2008, 2012, WinXP, Win7
Delphi 6 Pers.
BeitragVerfasst: Di 07.04.09 20:16 
Ja klar, die Meldung hat wahrscheinlich jeder schon mal gesehen. Bleibt nur noch die Frage: wie stell ich's an?
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 08.04.09 09:37 
Verbinde dich mit der administrativen Freigabe und den Administrator Logfindaten auf dem Remoterechner. Dann bist du autentifiziert.
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
(******************************************************************************
 *                                                                            *
 *  Network -- Some network routines                                          *
 *                                                                            *
 *  Copyright (c) 2006 Michael Puff  http://www.michael-puff.de               *
 *                                                                            *
 ******************************************************************************)


 (*****************************************************************************
 *                                                                            *
 *                         COPYRIGHT NOTICE                                   *
 *                                                                            *
 *  Copyright (c) 2001-2006, Michael Puff ["copyright holder(s)"]             *
 *  All rights reserved.                                                      *
 *                                                                            *
 *  Redistribution and use in source and binary forms, with or without        *
 *  modification, are permitted provided that the following conditions        *
 *  are met:                                                                  *
 *                                                                            *
 *  1. Redistributions of source code must retain the above copyright         *
 *     notice, this list of conditions and the following disclaimer.          *
 *  2. Redistributions in binary form must reproduce the above copyright      *
 *     notice, this list of conditions and the following disclaimer in        *
 *     the documentation and/or other materials provided with the             *
 *     distribution.                                                          *
 *  3. The name(s) of the copyright holder(s) may not be used to endorse      *
 *     or promote products derived from this software without specific        *
 *     prior written permission.                                              *
 *                                                                            *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       *
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT         *
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS         *
 *  FORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE             *
 *  REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,               *
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,      *
 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;          *
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER          *
 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT        *
 *  LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY      *
 *  WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE               *
 *  POSSIBILITY OF SUCH DAMAGE.                                               *
 *                                                                            *
 ******************************************************************************)


{$I ..\..\CompilerSwitches.inc}

unit Network;

interface

uses
  Windows;

function ConnectToNetworkDriveW(LocalName: WideString; RemoteName: wideString; Username: WideString; Password: WideString;
  RestoreAtLogon: boolean): DWORD;
function DisconnectNetworkDrivew(Name: WideString): DWORD;

implementation

function ConnectToNetworkDriveW(LocalName: WideString; RemoteName: wideString; Username: WideString; Password: WideString;
  RestoreAtLogon: boolean): DWORD;
var
  NetResource       : TNetResourceW;
  dwFlags           : DWORD;
begin
  dwFlags := 0;
  ZeroMemory(@NetResource, sizeof(TNetResource));
  with NetResource do
  begin
    dwType := RESOURCETYPE_ANY;
    lpLocalName := PWideChar(LocalName);
    lpRemoteName := PwideChar(RemoteName);
    lpProvider := nil;
  end;

  if (RestoreAtLogon) then
    dwFlags := dwFlags or CONNECT_UPDATE_PROFILE;

  Result := WNetAddConnection2W(NetResource, PWideChar(Password), PWideChar(Username), dwFlags);
end;

function DisconnectNetworkDrivew(Name: WideString): DWORD;
begin
  result := WNetCancelConnection2W(PWideChar(Name), CONNECT_UPDATE_PROFILE, True);
end;

end.
blaskito Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63

Win2003, 2008, 2012, WinXP, Win7
Delphi 6 Pers.
BeitragVerfasst: Mi 08.04.09 16:12 
Herzlichen Dank!

Das ist ja genau das, wonach ich gesucht habe.

Schöne Grüße aus dem Norden
blaskito