Bonjour, bonjour

Je vous expose mon soucis :

Je doit développer un launcher console pour une application. ce launcher lira les parametre a recupérer dans un csv pour les envoyé a un serveur. Parmis les information du CSV il y a 2 adresse ip. ces adresse serve a definir une CStringlist qui contiendra toute les ip a envoyé.


Mon soucis est au niveaux de cette méthode :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
BOOL CSelectHostsDlg::AddNetwork(BYTE nIpFromA, BYTE nIpFromB, BYTE nIpFromC, BYTE nIpFromD, BYTE nIpToA, BYTE nIpToB, BYTE nIpToC, BYTE nIpToD)
{
 
	try
	{
		BYTE	n;
		CString csAddress;
 
		if (nIpFromA == nIpToA)
		{
			// Address range is inside a single class A network
			if (nIpFromB == nIpToB)
			{
				// Address range is inside a single class B network
				if (nIpFromC == nIpToC)
				{
					// Address range is inside a single class C network
					for (n=nIpFromD; n<=nIpToD; n++)
					{
 
						csAddress.Format( _T( "%u.%u.%u.%u"), nIpFromA, nIpFromB, nIpFromC, n);
 
 
						m_pComputerList->AddTail(csAddress);
 
					}
					return TRUE;
				}
				// Address range is over mulitple class C networks
				for (n=nIpFromC; n<=nIpToC; n++)
				{
					if (n==nIpFromC)
					{
						// First class C, add only from first specified address
						if (!AddNetwork( nIpFromA, nIpFromB, n, nIpFromD, nIpFromA, nIpFromB, n, MAX_IP_RANGE))
							return FALSE;
					}
					else
					{
						if (n==nIpToC)
						{
							// Last class C, add only to last specified address
							if (!AddNetwork( nIpFromA, nIpFromB, n, 0, nIpFromA, nIpFromB, n, nIpToD))
								return FALSE;
						}
						else
						{
							// Full class C
							if (!AddNetwork( nIpFromA, nIpFromB, n, 0, nIpFromA, nIpFromB, n, MAX_IP_RANGE))
								return FALSE;
						}
					}
				}
				return TRUE;
			}
			// Address range is over mulitple class B networks
			for (n=nIpFromB; n<=nIpToB; n++)
			{
				if (n==nIpFromB)
				{
					// First class B, add only from first specified address
					if (!AddNetwork( nIpFromA, n, nIpFromC, nIpFromD, nIpFromA, n, MAX_IP_RANGE, MAX_IP_RANGE))
						return FALSE;
				}
				else
				{
					if (n==nIpToB)
					{
						// Last class B, add only to last specified address
						if (!AddNetwork( nIpFromA, n, 0, 0, nIpFromA, n, nIpToC, nIpToD))
							return FALSE;
					}
					else
					{
						// Full class B
						if (!AddNetwork( nIpFromA, n, 0, 0, nIpFromA, n, MAX_IP_RANGE, MAX_IP_RANGE))
							return FALSE;
					}
				}
			}
			return TRUE;
		}
		// Address range is over mulitple class A networks
		for (n=nIpFromA; n<=nIpToA; n++)
		{
			if (n==nIpFromA)
			{
				// First class A, add only from first specified address
				if (!AddNetwork( n, nIpFromB, nIpFromC, nIpFromD, n, MAX_IP_RANGE, MAX_IP_RANGE, MAX_IP_RANGE))
					return FALSE;
			}
			else
			{
				if (n==nIpToA)
				{
					// Last class A, add only to last specified address
					if (!AddNetwork( n, 0, 0, 0, n, nIpToB, nIpToC, nIpToD))
						return FALSE;
				}
				else
				{
					// Full class A
					if (!AddNetwork( n, 0, 0, 0, n, MAX_IP_RANGE, MAX_IP_RANGE, MAX_IP_RANGE))
						return FALSE;
				}
			}
		}
		return TRUE;
	}
	catch( CException *pEx)
	{
		pEx->ReportError( MB_OK|MB_ICONSTOP);
		pEx->Delete();
		return FALSE;
	}
}
Voici son appel :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
	BYTE  nIpFromA, nIpFromB, nIpFromC, nIpFromD, nIpToA, nIpToB, nIpToC, nIpToD;
				nIpFromA = (unsigned char)ipfromA;
				nIpFromB = (unsigned char)ipfromB;
				nIpFromC = (unsigned char)ipfromC;
				nIpFromD = (unsigned char)ipfromD;
				nIpToA = (unsigned char)iptoA;
				nIpToB = (unsigned char)iptoB;
				nIpToC = (unsigned char)iptoC;
				nIpToD = (unsigned char)iptoD;
 
 
 
					host.AddNetwork(nIpFromA, nIpFromB, nIpFromC, nIpFromD, nIpToA, nIpToB, nIpToC, nIpToD);
sachant que c'est une fonction déja utilisé par l'ancienne application.

et j'obtient ceci comme erreur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
Exception non gérée à 0x787b9f88 (mfc90d.dll) dans xxx.exe*: 0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0xcccccccc.
je doit avoué que je suis mis sur le carreaux par visual C++....

Merci d'avance pour l'aide ou les indications que vous pourriez me fournir.

Mathieu.