How to set folder icon without icon path?

  c++, winapi

So, I have a function that takes a png file and returns icon handle(IntPtr). I would like to set folder’s icon to the icon I get from that function. I looked through winapi documentation and I found HGetSetFolderCustomSettings function that takes HFOLDERCUSTOMSETTINGS structure as an argument. HFOLDERCUSTOMSETTINGS has pszIconFile that stores a path to an icon. So the only way to set icon is to give a path to that icon??? Can I use icon handle instead? Or is there a smart way to do it faster rather than just to save my icon as a file and get it’s path? The performance really matters. Thanks for any kind of help.

Source: Windows Questions C++