Obtenir le numéro de série du numéro du premier disque dur. C/C++

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <paths.h>
#include <sysexits.h>
#include <sys/param.h>

#include <CoreFoundation/CoreFoundation.h>

#include <IOKit/IOKitLib.h>
#include <IOKit/network/IOEthernetInterface.h>
#include <IOKit/network/IOEthernetController.h>
#include <IOKit/storage/ata/ATASMARTLib.h>

static kern_return_t FindEthernetInterfaces(io_iterator_t *matchingServices);
static kern_return_t GetMACAddress(io_iterator_t intfIterator, UInt8 *MACAddress);


// Returns an iterator across all known Ethernet interfaces. Caller is responsible for
// releasing the iterator when iteration is complete.
static kern_return_t FindEthernetInterfaces(io_iterator_t *matchingServices)
{
kern_return_t kernResult;
mach_port_t masterPort;
CFMutableDictionaryRef classesToMatch;

/*! @function IOMasterPort
@abstract Returns the mach port used to initiate communication with IOKit.
@discussion Functions that don't specify an existing object require the IOKit master port to be passed. This function obtains that port.
@param bootstrapPort Pass MACH_PORT_NULL for the default.
@param masterPort The master port is returned.
@result A kern_return_t error code. */

kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
if (KERN_SUCCESS != kernResult)
printf("IOMasterPort returned %d\n", kernResult);

/*! @function IOServiceMatching
@abstract Create a matching dictionary that specifies an IOService class match.
@discussion A very common matching criteria for IOService is based on its class. IOServiceMatching will create a matching dictionary that specifies any IOService of a class, or its subclasses. The class is specified by C-string name.
@param name The class name, as a const C-string. Class matching is successful on IOService's of this class or any subclass.
@result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */

// Ethernet interfaces are instances of class kIOEthernetInterfaceClass
classesToMatch = IOServiceMatching(kIOEthernetInterfaceClass);

// Note that another option here would be:
// classesToMatch = IOBSDMatching("en0");
// where X is a number from 0 to the number of Ethernet interfaces on the system - 1.

if (classesToMatch == NULL)
printf("IOServiceMatching returned a NULL dictionary.\n");

/*! @function IOServiceGetMatchingServices
@abstract Look up registered IOService objects that match a matching dictionary.
@discussion This is the preferred method of finding IOService objects currently registered by IOKit. IOServiceAddNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
@param masterPort The master port obtained from IOMasterPort().
@param matching A CF dictionary containing matching information, of which one reference is consumed by this function. IOKitLib can contruct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOOpenFirmwarePathMatching.
@param existing An iterator handle is returned on success, and should be released by the caller when the iteration is finished.
@result A kern_return_t error code. */

kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch, matchingServices);
if (KERN_SUCCESS != kernResult)
printf("IOServiceGetMatchingServices returned %d\n", kernResult);

return kernResult;
}

// Given an iterator across a set of Ethernet interfaces, return the MAC address of the first one.
// If no interfaces are found the MAC address is set to an empty string.
static kern_return_t GetMACAddress(io_iterator_t intfIterator, UInt8 *MACAddress)
{
io_object_t intfService;
io_object_t controllerService;
kern_return_t kernResult = KERN_FAILURE;

// Initialize the returned address
bzero(MACAddress, kIOEthernetAddressSize);

/*! @function IOIteratorNext
@abstract Returns the next object in an iteration.
@discussion This function returns the next object in an iteration, or zero if no more remain or the iterator is invalid.
@param iterator An IOKit iterator handle.
@result If the iterator handle is valid, the next element in the iteration is returned, otherwise zero is returned. The element should be released by the caller when it is finished. */

while (intfService = IOIteratorNext(intfIterator))
{
CFTypeRef MACAddressAsCFData;

// IONetworkControllers can't be found directly by the IOServiceGetMatchingServices call,
// matching mechanism. So we've found the IONetworkInterface and will get its parent controller
// by asking for it specifically.

kernResult = IORegistryEntryGetParentEntry( intfService,
kIOServicePlane,
&controllerService );

if (KERN_SUCCESS != kernResult)
printf("IORegistryEntryGetParentEntry returned 0x%08x\n", kernResult);
else {
/*! @function IORegistryEntryCreateCFProperty
@abstract Create a CF representation of a registry entry's property.
@discussion This function creates an instantaneous snapshot of a registry entry property, creating a CF container analogue in the caller's task. Not every object available in the kernel is represented as a CF container; currently OSDictionary, OSArray, OSSet, OSSymbol, OSString, OSData, OSNumber, OSBoolean are created as their CF counterparts.
@param entry The registry entry handle whose property to copy.
@param key A CFString specifying the property name.
@param allocator The CF allocator to use when creating the CF container.
@param options No options are currently defined.
@result A CF container is created and returned the caller on success. The caller should release with CFRelease. */

MACAddressAsCFData = IORegistryEntryCreateCFProperty( controllerService,
CFSTR(kIOMACAddress),
kCFAllocatorDefault,
0);
if (MACAddressAsCFData)
{
CFDataGetBytes(MACAddressAsCFData, CFRangeMake(0, kIOEthernetAddressSize), MACAddress);
CFRelease(MACAddressAsCFData);
}
/*! @function IOObjectRelease
@abstract Releases an object handle previously returned by IOKitLib.
@discussion All objects returned by IOKitLib should be released with this function when access to them is no longer needed. Using the object after it has been released may or may not return an error, depending on how many references the task has to the same object in the kernel.
@param object The IOKit object to release.
@result A kern_return_t error code. */

(void) IOObjectRelease(controllerService);
}

// We have sucked this service dry of information so release it now.
(void) IOObjectRelease(intfService);

// We're just interested in the first interface so exit the loop.
break;
}

return kernResult;
}

//To Get the customer serial number of the machine (serial-number + color-code)
bool GetSerialNumber(char serial[40])
{
bool result = false;
mach_port_t iokitPort;
io_registry_entry_t service;
CFStringRef keys[2] = { CFSTR("serial-number"), CFSTR("color-code")};
CFTypeRef values[2] = {NULL, NULL};

int icl;

char *sbytes = NULL, *cbytes = NULL, *sndptr = NULL;

if(IOMasterPort(MACH_PORT_NULL, &iokitPort) != KERN_SUCCESS)
return false;

//Build a dictionary to match with this class
service = IOServiceGetMatchingService(iokitPort, IOServiceMatching("IOPlatformExpertDevice"));

if(service == NULL)
return false;

// Get "serial-number" and "color-code" values
values[0] = IORegistryEntryCreateCFProperty(service, keys[0], nil, nil);
values[1] = IORegistryEntryCreateCFProperty(service, keys[1], nil, nil);

if (values[0] == NULL) goto exit;

sbytes = (char*)CFDataGetBytePtr((CFDataRef)values[0]);

if (values[1] != NULL)
cbytes = (char*)CFDataGetBytePtr((CFDataRef)values[1]);

sndptr = sbytes + strlen(sbytes) + 1;
icl =0;

while(icl < 20 && (*sndptr == 0))
{
icl++;
sndptr++;
}

//format the property values properly to fit with Apple System Profiler
sprintf(serial,"%.30s-%3.3s-%4.4hx", sndptr, sbytes, (cbytes ? *(short*)cbytes : 0xffff));
result = true;

exit:
if (service != NULL)
IOObjectRelease(service);

if (values[0] != NULL)
CFRelease(values[0]);
if (values[1] != NULL)
CFRelease(values[1]);

return result;
}


// To get the "Device Serial" of the first ATA Device.
bool GetDeviceSerial(char deviceserial[40])
{
bool result = false;
mach_port_t iokitPort;
io_registry_entry_t DSservice;
CFStringRef key = CFSTR("device serial");

if(IOMasterPort(MACH_PORT_NULL, &iokitPort) != KERN_SUCCESS)
return false;

// Build a Dictionary to match with _all_ ATADevice
DSservice = IOServiceGetMatchingService(iokitPort, IOServiceMatching("ATADeviceNub"));

if(DSservice == NULL)
return false;

CFStringRef data = NULL;

// Get from the first ATA Device the value of its "device serial" property
// key = "device serial"
data = IORegistryEntryCreateCFProperty(DSservice, key, nil, nil);

if (data == NULL)
goto exit;

//copy raw informations in a character array
CFStringGetBytes(data, CFRangeMake(0,CFStringGetLength(data)), kCFStringEncodingMacRoman,
0, 0, deviceserial, 40, NULL);
result = true;

exit:
if (DSservice != NULL)
IOObjectRelease(DSservice);

if (data != NULL)
CFRelease(data);

return result;
}

int main(int argc, char *argv
crazy.gif
)
{
kern_return_t kernResult = KERN_SUCCESS; // on PowerPC this is an int (4 bytes)
/*
* error number layout as follows (see mach/error.h and IOKitLib/IOReturn.h):
*
* hi lo
* | system(6) | subsystem(12) | code(14) |
*/

io_iterator_t intfIterator;
UInt8 MACAddress[ kIOEthernetAddressSize ];
bool testSNFunction;
char serial[40];
char deviceserial[40];

kernResult = FindEthernetInterfaces(&intfIterator);
if (KERN_SUCCESS != kernResult)
printf("FindEthernetInterfaces returned 0x%08x\n", kernResult);
else {
kernResult = GetMACAddress(intfIterator, MACAddress);
if (KERN_SUCCESS != kernResult)
printf("GetMACAddress returned 0x%08x\n", kernResult);
}
printf("Ethernet Address: %02x:%02x:%02x:%02x:%02x:%02x\n", MACAddress[0], MACAddress[1],
MACAddress[2], MACAddress[3],
MACAddress[4], MACAddress[5]);
IOObjectRelease(intfIterator); // Release the iterator.

testSNFunction = GetSerialNumber(serial);

if(testSNFunction == true)
printf("Customer serial number : %s\n", serial);
else
printf("Customer serial number not found\n");

testSNFunction = GetDeviceSerial(deviceserial);

if(testSNFunction == true)
printf("First ATA Device serial: %s\n", deviceserial);
else
printf("ATA Device not found\n");

return kernResult;
}


___________________

Désolé, mais c'est long lol. Tu as en plus l'adresse éthernet et le sn de ton mac
laugh.gif
 
Bon bah ca a l'air sympa ...
smile.gif


mon seul soucis ... et qui n'est pas des moindres ... puisque la je ne vois pas du tout d'ou cela provient ... codewarrior je pense mais bon ...

donc je suis sous code warrior 9 et osx 10.3.3
j'ai des erreurs dans les librairie ....

bon bref je passe ma route j'ai jamais pu supporté codewarrior ... de toute maniere ...je comptais utilisé gcc ... mais voila ... que ... j'ai a peu pres la même chose ...

ld: Undefined symbols:
_main
_CFStringGetBytes
_CFStringGetLength
_IORegistryEntryCreateCFProperty
_IOServiceGetMatchingService
_IOServiceMatching
_PA_ReturnString
___CFStringMakeConstantString

hum ... la euh ... je sais que je suis pas super doué en c ... et donc la ... j'ai du mal ...

merci pour votre aide ...
 
Les fonctions commençant par CF appartiennent à la librairie CoreFoundation et celles commençant par IO à IOKit, il faut certainement que tu ajoutes ces librairies à ton projet CW.
 
Et sous codewarrior ... voici ce que cela donne :

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 19 CFTypeID CFLocaleGetTypeID(void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 22 CFLocaleRef CFLocaleGetSystem(void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 26 CFLocaleRef CFLocaleCopyCurrent(void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 37 CFStringRef CFLocaleCreateCanonicalLocaleIdentifierFromString(CFAllocatorRef allocator, CFStringRef localeIdentifier) AVAILABLE

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 42 CFStringRef CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(CFAllocatorRef allocator, LangCode lcode, RegionCode

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 46 CFLocaleRef CFLocaleCreate(CFAllocatorRef allocator, CFStringRef localeIdentifier) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 50 CFLocaleRef CFLocaleCreateCopy(CFAllocatorRef allocator, CFLocaleRef locale) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 56 CFStringRef CFLocaleGetIdentifier(CFLocaleRef locale) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 61 CFTypeRef CFLocaleGetValue(CFLocaleRef locale, CFStringRef key) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 67 CF_EXPORT const CFStringRef kCFLocaleMeasurementSystem AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // "Metric" or "U.S."

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 68 CF_EXPORT const CFStringRef kCFLocaleDecimalSeparator AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 69 CF_EXPORT const CFStringRef kCFLocaleGroupingSeparator AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 70 CF_EXPORT const CFStringRef kCFLocaleCurrencySymbol AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
(included from:
CFDateFormatter.h:12
CoreFoundation.h:70
4DPlugin.c:23)
CFLocale.h line 71 CF_EXPORT const CFStringRef kCFLocaleCurrencyCode AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // ISO 3-letter currency code

Error : ';' expected
CFDateFormatter.h line 23 CFTypeID CFDateFormatterGetTypeID(void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFDateFormatter.h line 46 CFDateFormatterRef CFDateFormatterCreate(CFAllocatorRef allocator, CFLocaleRef locale, CFDateFormatterStyle dateStyle, CFDateFo

Error : ';' expected
CFDateFormatter.h line 51 CFLocaleRef CFDateFormatterGetLocale(CFDateFormatterRef formatter) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFDateFormatter.h line 54 CFDateFormatterStyle CFDateFormatterGetDateStyle(CFDateFormatterRef formatter) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFDateFormatter.h line 57 CFDateFormatterStyle CFDateFormatterGetTimeStyle(CFDateFormatterRef formatter) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFDateFormatter.h line 61 CFStringRef CFDateFormatterGetFormat(CFDateFormatterRef formatter) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFDateFormatter.h line 64 void CFDateFormatterSetFormat(CFDateFormatterRef formatter, CFStringRef formatString) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER

Error : ';' expected
CFDateFormatter.h line 74 CFStringRef CFDateFormatterCreateStringWithDate(CFAllocatorRef allocator, CFDateFormatterRef formatter, CFDateRef date) AVAILAB

Error : ';' expected
CFDateFormatter.h line 77 CFStringRef CFDateFormatterCreateStringWithAbsoluteTime(CFAllocatorRef allocator, CFDateFormatterRef formatter, CFAbsoluteTime

Error : ';' expected
CFDateFormatter.h line 83 CFDateRef CFDateFormatterCreateDateFromString(CFAllocatorRef allocator, CFDateFormatterRef formatter, CFStringRef string, CFRan

Error : ';' expected
CFDateFormatter.h line 86 Boolean CFDateFormatterGetAbsoluteTimeFromString(CFDateFormatterRef formatter, CFStringRef string, CFRange *rangep, CFAbsoluteT

Error : ';' expected
CFDateFormatter.h line 97 void CFDateFormatterSetProperty(CFDateFormatterRef formatter, CFStringRef key, CFTypeRef value) AVAILABLE_MAC_OS_X_VERSION_10_3

Error : ';' expected
CFDateFormatter.h line 100 CFTypeRef CFDateFormatterCopyProperty(CFDateFormatterRef formatter, CFStringRef key) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFDateFormatter.h line 104 CF_EXPORT const CFStringRef kCFDateFormatterIsLenient AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFBoolean

Error : ';' expected
CFDateFormatter.h line 105 CF_EXPORT const CFStringRef kCFDateFormatterTimeZone AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFTimeZone

Error : ';' expected
CFDateFormatter.h line 106 CF_EXPORT const CFStringRef kCFDateFormatterCalendarName AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFDateFormatter.h line 107 CF_EXPORT const CFStringRef kCFDateFormatterDefaultFormat AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFDateFormatter.h line 109 CF_EXPORT const CFStringRef kCFGregorianCalendar AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFNumberFormatter.h line 23 CFTypeID CFNumberFormatterGetTypeID(void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFNumberFormatter.h line 35 CFNumberFormatterRef CFNumberFormatterCreate(CFAllocatorRef allocator, CFLocaleRef locale, CFNumberFormatterStyle style) AVAILA

Error : ';' expected
CFNumberFormatter.h line 40 CFLocaleRef CFNumberFormatterGetLocale(CFNumberFormatterRef formatter) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFNumberFormatter.h line 43 CFNumberFormatterStyle CFNumberFormatterGetStyle(CFNumberFormatterRef formatter) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFNumberFormatter.h line 47 CFStringRef CFNumberFormatterGetFormat(CFNumberFormatterRef formatter) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

Error : ';' expected
CFNumberFormatter.h line 50 void CFNumberFormatterSetFormat(CFNumberFormatterRef formatter, CFStringRef formatString) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_L

Error : ';' expected
CFNumberFormatter.h line 60 CFStringRef CFNumberFormatterCreateStringWithNumber(CFAllocatorRef allocator, CFNumberFormatterRef formatter, CFNumberRef numbe

Error : ';' expected
CFNumberFormatter.h line 63 CFStringRef CFNumberFormatterCreateStringWithValue(CFAllocatorRef allocator, CFNumberFormatterRef formatter, CFNumberType numbe

Error : ';' expected
CFNumberFormatter.h line 73 CFNumberRef CFNumberFormatterCreateNumberFromString(CFAllocatorRef allocator, CFNumberFormatterRef formatter, CFStringRef strin

Error : ';' expected
CFNumberFormatter.h line 76 Boolean CFNumberFormatterGetValueFromString(CFNumberFormatterRef formatter, CFStringRef string, CFRange *rangep, CFNumberType n

Error : ';' expected
CFNumberFormatter.h line 89 void CFNumberFormatterSetProperty(CFNumberFormatterRef formatter, CFStringRef key, CFTypeRef value) AVAILABLE_MAC_OS_X_VERSION_

Error : ';' expected
CFNumberFormatter.h line 92 CFTypeRef CFNumberFormatterCopyProperty(CFNumberFormatterRef formatter, CFStringRef key) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LA

Error : ';' expected
CFNumberFormatter.h line 96 CF_EXPORT const CFStringRef kCFNumberFormatterCurrencyCode AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 97 CF_EXPORT const CFStringRef kCFNumberFormatterDecimalSeparator AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 98 CF_EXPORT const CFStringRef kCFNumberFormatterCurrencyDecimalSeparator AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 99 CF_EXPORT const CFStringRef kCFNumberFormatterAlwaysShowDecimalSeparator AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFBoolea

Error : ';' expected
CFNumberFormatter.h line 100 CF_EXPORT const CFStringRef kCFNumberFormatterGroupingSeparator AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 101 CF_EXPORT const CFStringRef kCFNumberFormatterUseGroupingSeparator AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFBoolean

Error : ';' expected
CFNumberFormatter.h line 102 CF_EXPORT const CFStringRef kCFNumberFormatterPercentSymbol AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 103 CF_EXPORT const CFStringRef kCFNumberFormatterZeroSymbol AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 104 CF_EXPORT const CFStringRef kCFNumberFormatterNaNSymbol AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 105 CF_EXPORT const CFStringRef kCFNumberFormatterInfinitySymbol AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 106 CF_EXPORT const CFStringRef kCFNumberFormatterMinusSign AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 107 CF_EXPORT const CFStringRef kCFNumberFormatterPlusSign AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 108 CF_EXPORT const CFStringRef kCFNumberFormatterCurrencySymbol AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 109 CF_EXPORT const CFStringRef kCFNumberFormatterExponentSymbol AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 110 CF_EXPORT const CFStringRef kCFNumberFormatterMinIntegerDigits AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 111 CF_EXPORT const CFStringRef kCFNumberFormatterMaxIntegerDigits AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 112 CF_EXPORT const CFStringRef kCFNumberFormatterMinFractionDigits AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 113 CF_EXPORT const CFStringRef kCFNumberFormatterMaxFractionDigits AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 114 CF_EXPORT const CFStringRef kCFNumberFormatterGroupingSize AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 115 CF_EXPORT const CFStringRef kCFNumberFormatterSecondaryGroupingSize AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 116 CF_EXPORT const CFStringRef kCFNumberFormatterRoundingMode AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 117 CF_EXPORT const CFStringRef kCFNumberFormatterRoundingIncrement AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 118 CF_EXPORT const CFStringRef kCFNumberFormatterFormatWidth AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 119 CF_EXPORT const CFStringRef kCFNumberFormatterPaddingPosition AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFNumber

Error : ';' expected
CFNumberFormatter.h line 120 CF_EXPORT const CFStringRef kCFNumberFormatterPaddingCharacter AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 121 CF_EXPORT const CFStringRef kCFNumberFormatterDefaultFormat AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; // CFString

Error : ';' expected
CFNumberFormatter.h line 142 Boolean CFNumberFormatterGetDecimalInfoForCurrencyCode(CFStringRef currencyCode, int32_t *defaultFractionDigits, double *roundi

Warning : identifier expected
IOATAStorageDefines.h line 196 };

Warning : identifier expected
IOATAStorageDefines.h line 235 };

Warning : identifier expected
IOATAStorageDefines.h line 264 };

Error : expression syntax error
4DPlugin.c line 76 CFStringRef data = NULL;

Error : undefined identifier 'data'
4DPlugin.c line 80 data = IORegistryEntryCreateCFProperty(DSservice, key, nil, nil);

Error : undefined identifier 'data'
4DPlugin.c line 86 CFStringGetBytes(data, CFRangeMake(0,CFStringGetLength(data)), kCFStringEncodingMacRoman,

Error : illegal implicit conversion from 'char[256]' to
'unsigned char *'
4DPlugin.c line 87 0, 0, returnValue, 40, NULL);

Could not find or load the file “4DPlugin.plc” for target “MachO Debug” for project “4D Plugin.mcp”.
 
il faut ajouter à ton projet, si tu utilises Xcode ou ProjectBuilder, les framework IOKit.framework et CFFoundation.framework.

Si c'est gcc sous terminal, il faut ajouter "-framework" "CoreFoundation" "-framework" "IOKit" à ta ligne de commande.
 
il faut ajouter à ton projet, si tu utilises Xcode ou ProjectBuilder, les framework IOKit.framework et CoreFoundation.framework.

Si c'est gcc sous terminal, il faut ajouter "-framework" "CoreFoundation" "-framework" "IOKit" à ta ligne de commande.
 
Bon ... sous codewarrior ... j'ai beau avoir les frameworks ... j'ai toujours les même erreurs.

sous gcc il me reste _PA_ReturnString ... mais je vois pas pourquoi ca chie ca ... parceque cela marche normalement puisque cela provient du Plugin SDK de 4D.

enfin ... bref .. j'ai tenté d'importer le projet sous xcode ... c'est guerre mieux g 289 erreurs et d'innombrable warning ... type d'erreur rencontré :

error: syntax error before void

typedef pascal void (*Call4DProcPtr) (short, EngineBlock*);

et ca cela provient aussi du 4D Plugin SDK