[HNETCFG] Sync with Wine Staging 3.3. CORE-14434
[reactos.git] / dll / win32 / hnetcfg / apps.c
index 51463e0..e63da7f 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+#include "netfw.h"
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
 #include "hnetcfg_private.h"
 
-#include <winnls.h>
-#include <ole2.h>
+WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg);
 
 typedef struct fw_app
 {
     INetFwAuthorizedApplication INetFwAuthorizedApplication_iface;
     LONG refs;
+    BSTR filename;
 } fw_app;
 
 static inline fw_app *impl_from_INetFwAuthorizedApplication( INetFwAuthorizedApplication *iface )
@@ -47,6 +61,7 @@ static ULONG WINAPI fw_app_Release(
     if (!refs)
     {
         TRACE("destroying %p\n", fw_app);
+        if (fw_app->filename) SysFreeString( fw_app->filename );
         HeapFree( GetProcessHeap(), 0, fw_app );
     }
     return refs;
@@ -239,7 +254,18 @@ static HRESULT WINAPI fw_app_get_ProcessImageFileName(
     fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
 
     FIXME("%p, %p\n", This, imageFileName);
-    return E_NOTIMPL;
+
+    if (!imageFileName)
+        return E_INVALIDARG;
+
+    if (!This->filename)
+    {
+        *imageFileName = NULL;
+        return S_OK;
+    }
+
+    *imageFileName = SysAllocString( This->filename );
+    return *imageFileName ? S_OK : E_OUTOFMEMORY;
 }
 
 static HRESULT WINAPI fw_app_put_ProcessImageFileName(
@@ -249,7 +275,15 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName(
     fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
 
     FIXME("%p, %s\n", This, debugstr_w(imageFileName));
-    return S_OK;
+
+    if (!imageFileName)
+    {
+        This->filename = NULL;
+        return S_OK;
+    }
+
+    This->filename = SysAllocString( imageFileName );
+    return This->filename ? S_OK : E_OUTOFMEMORY;
 }
 
 static HRESULT WINAPI fw_app_get_IpVersion(
@@ -372,6 +406,7 @@ HRESULT NetFwAuthorizedApplication_create( IUnknown *pUnkOuter, LPVOID *ppObj )
 
     fa->INetFwAuthorizedApplication_iface.lpVtbl = &fw_app_vtbl;
     fa->refs = 1;
+    fa->filename = NULL;
 
     *ppObj = &fa->INetFwAuthorizedApplication_iface;