473,396 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PfCreateInterface(...) Return 120

I Use Vista .
When I call PfCreateInterface(...) It Return error 120.
Can any body help me?
Apr 25 '10 #1
5 2919
tlhintoq
3,525 Expert 2GB
PfCreateInterface is your method in your program. Right?
How would anyone here know what it does?
Apr 25 '10 #2
PfCraeteInterface(...) exists in Iphlpapi.dll that exists in system32
it isn't my method .
so can any body help me?
please...
Apr 26 '10 #3
tlhintoq
3,525 Expert 2GB
This is covered on MSDN.
Have you gone through the MSDN write up?
http://msdn.microsoft.com/en-us/libr...73(VS.85).aspx

IP Helper is designed for C/C++ coding. You posted in the C# area. Which language are you trying to code in?

pfCreaterInterface() isn't even listed in the API functions. Have you worked through the tutorials and built the sample application first, just to get an understanding of the API? Or are you trying to apply this dll to your own application by just guessing and stabbing at it?
Apr 26 '10 #4
I write this code
Expand|Select|Wrap|Line Numbers
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace firewall
  7. {
  8.     class Program
  9.     {
  10.  
  11.         static void Main(string[] args)
  12.         {
  13.             IntPtr ppInterface=new IntPtr();
  14.             int Result=PfCreateInterface(0,0,0,true,true ,ref ppInterface );
  15.             Console.WriteLine(Result.ToString());
  16.             Console.ReadKey();
  17.         }
  18.         [System.Runtime.InteropServices.DllImport("iphlpapi.dll")]
  19.         public static extern int PfCreateInterface( uint dwName,
  20.                                                     uint inAction,
  21.                                                     uint outAction,
  22.                                                     bool bUseLog,
  23.                                                     bool bMustBeUnique,
  24.                                                    ref  IntPtr ppInterface );
  25.  
  26.     }
  27. }
  28.  
  29.  
when I try this code with XP the Output was "0" that mean NO_ERROR
but With Vista and 7 the Output was "120" that mean there is an error

please, Tell me if the code Work on Vista Or 7
Apr 27 '10 #5
tlhintoq
3,525 Expert 2GB
IP Helper is designed to be used from C and C++. It was not designed for C#, as you are using it.

With that said, you might be able to get away with importing commands as you have done. But at the very least you need to limit what you try to do to the commands that are published as available. And "CreateInterface" is not one of them.
http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx

Most of us at one time or another have probably used code in a way not designed by the publisher. I know I have. But the results can be unpredictable.

If you want to know if something undocumented and untested will work in a new operating system then you will need to do your own testing.
Apr 27 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Phil Powell | last post by:
My first time working with a PHP class, and after 6 hours of working out the kinks I am unable to return a value from the class, so now I appeal to the general audience what on earth did I do wrong...
20
by: Jakob Bieling | last post by:
Hi! I am using VC++ 7.1 and have a question about return value optimization. Consider the following code: #include <list> #include <string> struct test {
25
by: cppaddict | last post by:
I'd like to know what goes on under the hood when methods return objects. Eg, I have a simple Point class with two members _x and _y. It's constructor, copy constructor, assignment operator and...
2
by: PengYu.UT | last post by:
I have the following sample program, which can convert function object with 1 argument into function object with 2 arguments. It can also do + between function object of the same type. The last...
6
by: Bruce W.1 | last post by:
The intent of my web service is an RSS feed from a blog. Originally I used a StringBuilder to make the XML and returned a string from the webmethod. But this doesn't display properly in IE. So...
2
by: Rhino | last post by:
I am trying to verify that I correctly understand something I saw in the DB2 Information Center. I am running DB2 Personal Edition V8.2.1 on Windows. I came across the following in the Info...
10
by: LaEisem | last post by:
On-the-job, I have "inherited" a lot of old C language software. A question or two about when "casting" of null pointer constants is needed has occurred during behind-the-scenes cleanup of some...
3
by: kikazaru | last post by:
Is it possible to return covariant types for virtual methods inherited from a base class using virtual inheritance? I've constructed an example below, which has the following structure: Shape...
6
KoreyAusTex
by: KoreyAusTex | last post by:
If anyone can help me figure out the what the missing return statements are, I think it might be the fact that I need to add a return false in the getValue()? import java.util.*; public class...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.