The WinCSVStartup function allows an application to specify the version of Windows CSV required and to retrieve details of the specific Windows CSV implementation. This function must be called by an application to register itself with a Windows CSV implementation before issuing any further Windows CSV calls.
int WINAPI WinCSVStartup(
WORD wVersionRequired,
LPWCSVDATA lpwcsvdata
);
typedef struct tagWCSVDATA {
....WORD wVersion;
char szDescription[WCSVDESCRIPTION_LEN+1];
} CSVDATA, FAR * LPWCSVCDATA;
This lpwcsvdata structure provides information about the underlying Windows CSV DLL implementation. The first wVersion field has the same structure as the wVersionRequired parameter, and the szDescription field contains a string identifying the vendor of the Windows CSV DLL. The description field is only meant to provide a display string for the application and should not be used to programmatically distinguish between Windows CSV implementations.
The return value specifies whether the application was registered successfully and whether the Windows CSV implementation can support the specified version number. If the value is zero, it was registered successfully. Otherwise, the return value is one of the following:
To support future Windows CSV implementations and applications that may have functionality differences from Windows CSV version 1.0, a negotiation takes place in WinCSVStartup. An application passes to WinCSVStartup the Windows CSV version that it can use. If this version is lower than the lowest version supported by the Windows CSV DLL, the DLL cannot support the application and WinCSVStartup fails. If the version is not lower, however, the call succeeds and returns the highest version of Windows CSV supported by the DLL. If this version is lower than the lowest version supported by the application, the application either fails its initialization or attempts to find another Windows CSV DLL on the system.
This negotiation allows both a Windows CSV DLL and a Windows CSV application to support a range of Windows CSV versions. An application can successfully use a DLL if there is any overlap in the versions. The following table illustrates how WinCSVStartup works in conjunction with different application and DLL versions.
Application versions | DLL versions |
To WinCSVStartup | From WinCSVStartup | Result |
---|---|---|---|---|
1.0 | 1.0 | 1.0 | 1.0 | Use 1.0 |
1.0, 2.0 | 1.0 | 2.0 | 1.0 | Use 1.0 |
1.0 | 1.0, 2.0 | 1.0 | 2.0 | Use 1.0 |
1.0 | 2.0, 3.0 | 1.0 | WCSVINVALID | Fail |
2.0, 3.0 | 1.0 | 3.0 | 1.0 | App Fails |
1.0, 2.0, 3.0 | 1.0, 2.0, 3.0 | 3.0 | 3.0 | Use 3.0 |
After making its last Windows CSV call, an application should call WinCSVCleanup.
Each Windows CSV implementation must make a WinCSVStartup call before issuing any other Windows CSV calls. Consequently, this function can be used for initialization purposes.