summaryrefslogblamecommitdiffstats
path: root/private/unimodem/new/mic/inf.cpp
blob: 471530a1d48ea789c86d26fcd9daed4d195221a3 (plain) (tree)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903






































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                     
//
//		Copyright (c) 1996 Microsoft Corporation
//
//
//		INF.CPP		-- Implemtation for Classes:
//							CInfFile
//
//		History:
//			05/21/96	JosephJ		Created
//
//
#include "common.h"
#include "ini.h"
#include "inf.h"

// Version-related constants
LPCTSTR lpctszVersion		= TEXT("Version");
LPCTSTR lpctszLayoutFile	= TEXT("LayoutFile");
LPCTSTR lpctszSignature		= TEXT("Signature");
LPCTSTR lpctszClass			= TEXT("Class");
LPCTSTR lpctszClassGUID		= TEXT("ClassGUID");
LPCTSTR lpctszProvider		= TEXT("Provider");


LPCTSTR lpctszManufacturer	= TEXT("Manufacturer");
LPCTSTR lpctszControlFlags	= TEXT("ControlFlags");
LPCTSTR lpctszStrings		= TEXT("Strings");

///////////////////////////////////////////////////////////////////////////
//		CLASS CInfFile
///////////////////////////////////////////////////////////////////////////


CInfFile::CInfFile(void)
{
	m_pVersion=NULL;
	m_pFirstManuE=NULL;
	m_pSymFileName=NULL;
	m_pIniFile=NULL;
}


CInfFile::~CInfFile()
{
	mfn_EnterCrit();

	// Free resources -- there should be none to free...
	ASSERT(!m_pVersion);
	ASSERT(!m_pFirstManuE);
	ASSERT(!m_pIniFile);

}


//--------------	Load			------------------
// Loads the specified file. (Obviously) only one file can be loaded at
// a time.
BOOL CInfFile::Load	(const TCHAR rgchPathname[])
{
	BOOL fRet = FALSE;

	mfn_EnterCrit();

	// TODO: call m_sync.BeginLoad

	ASSERT(!m_pVersion);
	ASSERT(!m_pFirstManuE);
	ASSERT(!m_pIniFile);

	// Save file name
	m_pSymFileName = gSymtab.Lookup(rgchPathname, TRUE);
	if (!m_pSymFileName) goto end;

	// Create and Load Ini File
	m_pIniFile  = new CIniFile;
	if (m_pIniFile)
	{
		if (!m_pIniFile->Load(rgchPathname))
		{
			delete m_pIniFile;
			m_pIniFile=NULL;
		}
	}
	if (!m_pIniFile) goto end;

	// Create and Load version
	{
		CInfVersionSection *pVS = new CInfVersionSection;
		if (pVS)
		{
			// Override const * declaration of m_pVersion
			if (!pVS->Load(m_pIniFile))
			{
				delete pVS;
				pVS=NULL;
			}
		}
		m_pVersion = pVS;
	}
	if (!m_pVersion) goto end;

	// Create and load Manufacturer list...
	m_pFirstManuE = sfn_CreateManufacturerList(m_pIniFile);
	if (!m_pFirstManuE) goto end;

	fRet = TRUE;

end:

	if (!fRet)
	{
		mfn_Cleanup();
	}

	mfn_LeaveCrit();

	return fRet;
}


//--------------	Unload			------------------
// Unloads a previously loaded file. If there are open sessions to this
// object, Unload returns a handle which will be signalled when all
// sessions are closed. New sessions will not be allowed after this
// function returns. The call should free the handle.
HANDLE CInfFile::Unload	(void)
{
	HANDLE hUnload = NULL;

	mfn_EnterCrit();

	// TODO: call m_sync.BeginUnload to try to put us in unloadable state.

	mfn_Cleanup();

	mfn_LeaveCrit();


	return hUnload;
}


///////////////////////////////////////////////////////////////////////////
//		CLASS CInfVersionSection
///////////////////////////////////////////////////////////////////////////

// Sample Version section:
//		[Version]
//		LayoutFile=layout.inf
//		Signature="$CHICAGO$"
//		Class=Modem
//		ClassGUID={4D36E96D-E325-11CE-BFC1-08002BE10318}
//		Provider=%MS%
	

//--------------	Load			------------------
// TODO: unimplemented
BOOL CInfVersionSection::Load	(const CIniFile *pIniFile)
{
	BOOL fRet = FALSE;
	const CIniFileSection *pISVer = pIniFile->LookupSection(lpctszVersion);
	const CIniFileSection *pISStr = pIniFile->LookupSection(lpctszStrings);
	const CIniFileEntry   *pIE  = NULL;

#if 0
	m_pSymLayoutFile	= gSymtab.Lookup(TEXT("layout.inf"), TRUE);
	m_pSymSignature		= gSymtab.Lookup(TEXT("\"$CHICAGO$\""), TRUE);
	m_pSymClass			= gSymtab.Lookup(TEXT("Modem"), TRUE);
	m_pSymClassGUID		= gSymtab.Lookup
						  (
							TEXT("{4D36E96D-E325-11CE-BFC1-08002BE10318}"),
							TRUE
						  );
	m_pSymProvider		= gSymtab.Lookup(TEXT("Microsoft"), TRUE);

	m_dwChecksum		= 0x12345678L;
#endif

	ASSERT
	(
			!m_pSymLayoutFile
		&&	!m_pSymSignature
		&&	!m_pSymClass	
		&&	!m_pSymClassGUID
		&&	!m_pSymProvider	
		&&	!m_dwChecksum
	);

	if (!pISVer || !pISStr) goto end;

	//		LayoutFile=layout.inf
	pIE = pISVer->LookupEntry(lpctszLayoutFile);
	if (pIE)
	{
		m_pSymLayoutFile	= pIE->GetRHS();
		pIE->Release();pIE=NULL;
		// TODO: further checks here
	}

	//		Signature="$CHICAGO$"
	pIE = pISVer->LookupEntry(lpctszSignature);
	if (pIE)
	{
		m_pSymSignature	= pIE->GetRHS();
		pIE->Release();pIE=NULL;
		// TODO: further checks here
	}

	//		Class=Modem
	pIE = pISVer->LookupEntry(lpctszClass);
	if (pIE)
	{
		m_pSymClass	= pIE->GetRHS();
		pIE->Release();pIE=NULL;
		// TODO: further checks here
	}

	//		ClassGUID={4D36E96D-E325-11CE-BFC1-08002BE10318}
	pIE = pISVer->LookupEntry(lpctszClassGUID);
	if (pIE)
	{
		m_pSymClassGUID	= pIE->GetRHS();
		pIE->Release();pIE=NULL;
		// TODO: further checks here
	}

	//		Provider=%MS%
	pIE = pISVer->LookupEntry(lpctszProvider);
	if (pIE)
	{
		const CInfSymbol *pSymLHS	= pIE->GetLHS();
		pIE->Release();pIE=NULL;

		if (pSymLHS)
		{
			pIE	= pISStr->LookupEntry(pSymLHS->GetText());
			if (pIE)
			{
				m_pSymProvider	= pIE->GetRHS();
				pIE->Release();pIE=NULL;
			}
		}
		// TODO: further checks here
	}

	// Compute checksum of entire version structure
	m_dwChecksum = m_pSymLayoutFile->Checksum();
	AddToChecksumDW(&m_dwChecksum, m_pSymSignature->Checksum());
	AddToChecksumDW(&m_dwChecksum, m_pSymClass->Checksum());
	AddToChecksumDW(&m_dwChecksum, m_pSymClassGUID->Checksum());
	AddToChecksumDW(&m_dwChecksum, m_pSymProvider->Checksum());

	fRet =TRUE;

end:

	if (pIE) 	{ pIE->Release(); pIE=NULL; }
	if (pISVer) { pISVer->Release(); pISVer=NULL; }
	if (pISStr) { pISStr->Release(); pISStr=NULL; }

	if (!fRet)
	{
		mfn_Cleanup();
	}

	return fRet;
}


//--------------	Unload			------------------
void CInfVersionSection::Unload	(void)
{
	// TODO: call m_sync.BeginUnload to try to put us in unloadable state.

	mfn_Cleanup();

	return;
}



//--------------	Dump			------------------
// Dump state
void
CInfVersionSection::Dump(void)
const
{
}

// Cleanup by freeing any allocated resources.
void	CInfVersionSection::mfn_Cleanup (void)
{
		m_pSymLayoutFile	= NULL;
		m_pSymSignature		= NULL;
		m_pSymClass			= NULL;;
		m_pSymClassGUID		= NULL;
		m_pSymProvider		= NULL;
		m_dwChecksum		= 0;
}


///////////////////////////////////////////////////////////////////////////
//		CLASS CInfManufacturerEntry
///////////////////////////////////////////////////////////////////////////

// Sample Manufacturer list section:
//		[Manufacturer]
//		%Generic%     = Generic
//		%MagicRam%    = MagicRam
// 		..


///////////////////////////////////////////////////////////////////////////
//		CLASS CInfManufacturerSection
///////////////////////////////////////////////////////////////////////////

// Sample Manufacturer section:
//		[Generic]
//		%Gen%    = Gen,    MDMGEN
//		%Gen3%   = Gen3,   MDMGEN3
//		%Gen12%  = Gen12,  MDMGEN12
//		%Gen24%  = Gen24,  MDMGEN24
//		...


// ---------------	GetFirstModelEntry	--------------
// Get first model entry
const	CInfModelEntry		*
CInfManufacturerSection::GetFirstModelEntry	(void)
const
{
	return m_pFirstModelE;
}

///////////////////////////////////////////////////////////////////////////
//		CLASS CInfInstallSection
///////////////////////////////////////////////////////////////////////////

// Sample Install section:
//		[Modem29]
//		AddReg=All, MfgAddReg, ROCK_VOICE_ALL, ROCK_VOICE_SERWAVE, INTERNAL
//		CopyFiles   = VV_Sys, VV_Sock_Sys, VV_App, VV_Help
//		UpdateInis  = VView.Inis
//		Uninstall   = VoiceView_remove
//
// Also contains info from the related PosDup and NoResDup sections.


// ---------------	GetAddRegSectionList	----------
// Get generic list whose data items are pointers to
// CInfAddRegSection objects
const CInfList		*
CInfInstallSection::GetAddRegSectionList	(void)
const
{
	// TODO: unimplemented

	static const CInfAddRegSection AddRegSection;
	static const CInfList AddRegSectionList((void *) &AddRegSection, NULL);

	return &AddRegSectionList;
}


// ---------------	GetCopyFilesSectionList	----------
// Get generic list whose data items are pointers to
// CInfCopyFilesSection objects
const CInfList		*
CInfInstallSection::GetCopyFilesSectionList	(void)
const
{
	// TODO: unimplemented

	static const CInfCopyFilesSection CopyFilesSection;
	static const CInfList CopyFilesSectionList((void *) &CopyFilesSection, NULL);

	return &CopyFilesSectionList;
}


// ---------------	GetNoResDupIDList		----------
// Get generic list whose data items are pointers to
// InfSymbol objects representing the Rank0 IDs in the corresponding
// NoResDup section.
const CInfList		*
CInfInstallSection::GetNoResDupIDList	(void)
const
{
	// TODO: unimplemented

	static const CInfList NoResDupIDList
						  (
							(void *) gSymtab.Lookup(TEXT("NORESDUP-ID"), TRUE),
							NULL
						  );

	return &NoResDupIDList;
}


// ---------------	GetPosDupIDList		----------
// Get generic list whose data items are pointers to
// InfSymbol objects representing the Rank0 IDs in the corresponding
// PosDup section.
// const	CInfList		*	GetPosDupIDList	(void)	const;
const CInfList		*
CInfInstallSection::GetPosDupIDList	(void)
const
{
	// TODO: unimplemented
	static const CInfList PosDupIDList1
						  (
							(void *) gSymtab.Lookup(TEXT("POSDUP-ID1"), TRUE),
							NULL
						  );
	static const CInfList PosDupIDList
						  (
							(void *) gSymtab.Lookup(TEXT("POSDUP-ID0"), TRUE),
							&PosDupIDList1
						  );

	return &PosDupIDList;
}


///////////////////////////////////////////////////////////////////////////
//		CLASS CInfAddRegSection
///////////////////////////////////////////////////////////////////////////

// Sample AddReg section:
//		[All]
//		HKR,,FriendlyDriver,,Unimodem.vxd
//		HKR,,DevLoader,,*vcomm
//		HKR,,ConfigDialog,,modemui.dll
//		HKR,,EnumPropPages,,"modemui.dll,EnumPropPages"
//		HKR,,PortSubClass,1,02
//		HKR, Init, 1,, "AT<cr>"
//		HKR, Responses, "<cr><lf>OK<cr><lf>", 1, 00, 00, 00,00,00,00, ...etc.
//		HKR, Responses, "<cr><lf>ERROR<cr><lf>", 1, 03, 00, 00,00,00, ...etc.


// Get first addreg entry
const CInfAddRegEntry *
CInfAddRegSection::GetFirstAddRegEntry	(void)
const
{
	// TODO -- fake static entries
	static const CInfAddRegEntry FirstAddRegEntry;
	return &FirstAddRegEntry;
}


///////////////////////////////////////////////////////////////////////////
//		CLASS CInfCopyFilesSection
///////////////////////////////////////////////////////////////////////////

// Sample DestinationDirs section:
//		[DestinationDirs]
//		Register.Copy    = 17     ;LDID_INF
//		VV_Sys           = 11           
//		VV_Sock_Sys      = 11     ;LDID_SYS \Windows\system dir
//		VV_Sock_Win      = 10     ;LDID_WIN \Windows dir
//		VV_App           = 10
//		VV_Help          = 18     ;LDID_HELP

// Sample Copyfiles section:
//		[VV_Sys]
//		fte.dll
//		vvexe32.exe
//		wsvv.vxd


// ---------------	GetFirstCopyFilesEntry	----------
// Get first copyfiles entry
const	CInfCopyFilesEntry		*
CInfCopyFilesSection::GetFirstCopyFilesEntry	(void)	const
{
	// TODO -- fake static entries
	static const CInfCopyFilesEntry FirstCopyFilesEntry;
	return &FirstCopyFilesEntry;
}


// Cleanup by freeing any allocated resources.
// TODO: unimplemented
void	CInfFile::mfn_Cleanup (void)
{
	mfn_EnterCrit();

	// TODO: ASSERT(state == loading or state == unloading)

	// Unload and free version
	if (m_pVersion)
	{
		// override const *
		CInfVersionSection *pVS = (CInfVersionSection *) m_pVersion;
		pVS->Unload();
		delete pVS;
		m_pVersion=NULL;
	}


	// Unload and free Manufacturerlist.
	if (m_pFirstManuE)
	{
		sfn_DeleteManufacturerList(m_pFirstManuE);
		m_pFirstManuE=NULL;
	}

	if (m_pIniFile)
	{
		m_pIniFile->Unload();
		delete (CIniFile *) m_pIniFile; // override const *
		m_pIniFile=NULL;
	}

	m_pSymFileName=NULL;

	mfn_LeaveCrit();
}

// static helper function...
const CInfManufacturerEntry * 
CInfFile::sfn_CreateManufacturerList (CIniFile *pIniFile)
{
	CInfManufacturerEntry * pManuE = NULL;
	const CIniFileSection *pISStr = pIniFile->LookupSection(lpctszStrings);
	const CIniFileSection *pISManL =
									pIniFile->LookupSection(lpctszManufacturer);
	CIniFileEntry   *pIE  = NULL;

	if (!pISManL || !pISStr) goto end;

	pIE = pISManL->GetFirstEntry();
	if (!pIE) goto end;

	// Iterate through manufacturers, building manufacturer entries...
	do
	{
		pManuE = new CInfManufacturerEntry(pManuE);
		if (!pManuE || !pManuE->Load(pIniFile, pISStr, pIE))
		{
			// TODO: warning; for now break out.
			if (pManuE)
			{
				// TODO delete previously-created elements of the list as well!
				// (Or leave them there and deal with a partial list).
				delete pManuE;
				pManuE = NULL;
			}
			goto end;
		}

	} while(pIE->BecomeNext());

	// Reverse list
	CInfManufacturerEntry::ReverseList(&pManuE);

end:
	if (pIE) {pIE->Release(); pIE=NULL;}
	if (pISManL)	{ pISManL->Release(); pISManL=NULL; }
	if (pISStr)		{ pISStr->Release(); pISStr=NULL; }

	return pManuE;
}

// Static helper function
void 
CInfFile::sfn_DeleteManufacturerList
(
	const CInfManufacturerEntry * pManuEFirst
)
{
	// TODO
}

// ---------------	Load			------------------
BOOL
CInfManufacturerEntry::Load
(
	const CIniFile *pIniFile,
	const CIniFileSection *pISStr,
	const CIniFileEntry *pIE
)
{
	BOOL fRet = FALSE;
	const CInfSymbol *pSymLHS	= pIE->GetLHS();
	const CInfSymbol *pSymManuName	= NULL;
	 // TODO need to make manu-section case insensitive!
	 // Basically pSymManuSection should be created based on an upper-case'd
	 // version of pIE->GetRHS().
	const CInfSymbol *pSymManuSection	= pIE->GetRHS();
	CInfManufacturerSection *pManuS = NULL;
	BOOL fNew=FALSE;

	ASSERT(!m_pManuS);
	ASSERT(!m_pSymManuName);

	// Get manufacturer name ...
	if (pSymLHS)
	{
		const CIniFileEntry *pIEStr	= pISStr->LookupEntry(pSymLHS->GetText());
		if (pIEStr)
		{
			pSymManuName	= pIE->GetRHS();
			pIEStr->Release();pIEStr=NULL;
		}
	}

	pManuS=NULL;

	// Look up/create manufacturer section
	{
		void **ppv=NULL;
		BOOL fExists=FALSE;
		BOOL fRet = pSymManuSection->GetOrCreatePropLoc(
											PROP_INFSECTION_MANUFACTURER,
											&ppv,
											&fExists);
		if (fRet)
		{
			if (fExists)
			{
				// This section already exists...
				pManuS = (CInfManufacturerSection *) *ppv;
				ASSERT(pManuS->Validate());
			}
			else
			{
				// This section doesn't exist -- create it.
				pManuS = new CInfManufacturerSection();
				if (pManuS)
				{
					if (pManuS->Load(pIniFile, pISStr, pSymManuSection))
					{
						// set the property data
						*ppv = (void *) pManuS;
					}
					else
					{
						delete pManuS;
						pManuS=NULL;
						pSymManuSection->DelProp(PROP_INFSECTION_MANUFACTURER);
					}
				}
			}
		}
	}
				
	if (pManuS)
	{
		m_pManuS = pManuS;
		m_pSymManuName = pSymManuName;
		fRet = TRUE;
	}

	if (!fRet)
	{
		mfn_Cleanup();
	}

	return fRet;

}

// ---------------	Unload			------------------
void	CInfManufacturerEntry::Unload(void)
// TODO
{
	m_pManuS = NULL;
	m_pSymManuName = NULL;
	// TODO: decrement ref count for the section and delete it  and delprop
	// it when done.
	mfn_Cleanup();

}


// ---------------	Cleanup			------------------
// Cleanup by freeing any allocated resources.
void	CInfManufacturerEntry::mfn_Cleanup (void)
{
	m_pManuS = NULL;
	m_pSymManuName = NULL;
}


// ---------------	Load	------------------
BOOL
CInfManufacturerSection::Load
(
	const CIniFile *pIniFile,
	const CIniFileSection *pISStr,
	const CInfSymbol *pSymManuSection
)
{
	BOOL fRet = FALSE;
	const CIniFileSection *pIS =
					pIniFile->LookupSection(pSymManuSection->GetText());

	ASSERT(!m_pSymSectionName);
	ASSERT(!m_pFirstModelE);
	ASSERT(m_eObjSig==eOBJSIG_CInfManufacturerSection);

	if (!pIS)
	{
		goto end;
	}

	m_pSymSectionName = pSymManuSection;

	// Create and load model list
	m_pFirstModelE = sfn_CreateModelList(pIniFile, pISStr, pIS);

	if (!m_pFirstModelE)
	{
		goto end;
	}

	fRet = TRUE;

end:

	if (!fRet)
	{
		mfn_Cleanup();
	}

	return fRet;
}

// ---------------	Unload			------------------
void	CInfManufacturerSection::Unload(void)
{
	mfn_Cleanup();
}


// ---------------	Cleanup			------------------
// Cleanup by freeing any allocated resources.
void	CInfManufacturerSection::mfn_Cleanup (void)
// TODO
{
	m_pSymSectionName	= NULL;
	m_pFirstModelE		= NULL;
}


// Static helper function to create the list of models for this manufacturer
const	CInfModelEntry		*
CInfManufacturerSection::sfn_CreateModelList
(
		const CIniFile *pIniFile,
		const CIniFileSection *pISStr,
		const CIniFileSection *pISManuS
)
{
	CInfModelEntry * pModelE = NULL;
	CIniFileEntry   *pIE  = NULL;

	if (!pISManuS || !pISStr) goto end;

	pIE = pISManuS->GetFirstEntry();
	if (!pIE) goto end;

	// Iterate through models, building model entries...
	do
	{
		pModelE = new CInfModelEntry(pModelE);
		if (!pModelE || !pModelE->Load(pIniFile, pISStr, pIE))
		{
			// TODO: warning; for now break out.
			if (pModelE)
			{
				// TODO delete previously-created elements of the list as well!
				// (Or leave them there and deal with a partial list).
				delete pModelE;
				pModelE = NULL;
			}
			goto end;
		}

	} while(pIE->BecomeNext());

	// Reverse list
	CInfModelEntry::ReverseList(&pModelE);

end:
	if (pIE) {pIE->Release(); pIE=NULL;}
	//if (pISManL)	{ pISManL->Release(); pISManL=NULL; }
	//if (pISStr)		{ pISStr->Release(); pISStr=NULL; }

	return pModelE;
}


// ---------------	Cleanup			------------------
// Cleanup by freeing any allocated resources.
void	CInfModelEntry::mfn_Cleanup (void)
// TODO
{
}


// ---------------	Load			------------------
BOOL
CInfModelEntry::Load
(
	const CIniFile *pIniFile,
	const CIniFileSection *pISStr,
	const CIniFileEntry *pIE
)
// TODO
{
	return TRUE;
#if 0
	BOOL fRet = FALSE;
	const CInfSymbol *pSymLHS	= pIE->GetLHS();
	const CInfSymbol *pSymManuName	= NULL;
	 // TODO need to make manu-section case insensitive!
	 // Basically pSymManuSection should be created based on an upper-case'd
	 // version of pIE->GetRHS().
	const CInfSymbol *pSymManuSection	= pIE->GetRHS();
	CInfManufacturerSection *pManuS = NULL;
	BOOL fNew=FALSE;

	ASSERT(!m_pManuS);
	ASSERT(!m_pSymManuName);

	// Get manufacturer name ...
	if (pSymLHS)
	{
		const CIniFileEntry *pIEStr	= pISStr->LookupEntry(pSymLHS->GetText());
		if (pIEStr)
		{
			pSymManuName	= pIE->GetRHS();
			pIEStr->Release();pIEStr=NULL;
		}
	}

	pManuS=NULL;

	// Look up/create manufacturer section
	{
		void **ppv=NULL;
		BOOL fExists=FALSE;
		BOOL fRet = pSymManuSection->GetOrCreatePropLoc(
											PROP_INFSECTION_MANUFACTURER,
											&ppv,
											&fExists);
		if (fRet)
		{
			if (fExists)
			{
				// This section already exists...
				pManuS = (CInfManufacturerSection *) *ppv;
				ASSERT(pManuS->Validate());
			}
			else
			{
				// This section doesn't exist -- create it.
				pManuS = new CInfManufacturerSection();
				if (pManuS)
				{
					if (pManuS->Load(pIniFile, pISStr, pSymManuSection))
					{
						// set the property data
						*ppv = (void *) pManuS;
					}
					else
					{
						delete pManuS;
						pManuS=NULL;
						pSymManuSection->DelProp(PROP_INFSECTION_MANUFACTURER);
					}
				}
			}
		}
	}
				
	if (pManuS)
	{
		m_pManuS = pManuS;
		m_pSymManuName = pSymManuName;
		fRet = TRUE;
	}

	if (!fRet)
	{
		mfn_Cleanup();
	}

	return fRet;
#endif

}

// ---------------	Unload			------------------
void	CInfModelEntry::Unload(void)
// TODO
{
	mfn_Cleanup();
}