// Rudimentaire.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <setupapi.h>

#include <iostream>
#include <string>

using namespace std;


string GetCurDir()
{
	TCHAR buffer[MAX_PATH+1];
	::GetCurrentDirectory(sizeof(buffer), buffer);
	return buffer;
}

int main(int argc, char* argv[])
{
	WCHAR buffer[MAX_PATH+1];

	string filename;
	string command = "DefaultInstall 128 ";

	cout << endl << "Installation de HelloProg" << endl;
	filename = GetCurDir();
	filename += "\\programmez.inf";
	command += filename;
	cout << "Commande d'installation: " << command << endl;

	MultiByteToWideChar(CP_ACP, 0,
		command.c_str(), -1,
		buffer, sizeof(buffer));

	::InstallHinfSectionW(NULL, NULL, buffer, 0);

	cout << "Installation terminee, appuyez sur une touche" << endl;
	cin.get();
	return 0;
}
