I want to add a new "string value" for a specified entry in the registry.

Under HKEY_LOCAL_MACHINE i have SOFTWARE under it i have say TEMP now i want to add a new "string value" say DirPath under this TEMP

and set the value for DirPath= "c:\TEMP"

how to do this. Ithink it can be done using some API.