how to utilize $scmp/$sicmp ?

Hi, everybody here,

I want windbg stop when my target program open certain file,

I tried:

bp CreateFileA “.if($scmp(poi(esp+4),"c:\foo.txt")==0){.echo hit!!!;}.else{g;}”

but it doesn’t work. I also tried:

bp CreateFileA “r $t1=poi(esp+4);.if($scmp($t1,"c:\foo.txt")==0){.echo hit!!!;}.else{g;}”

It doesn’t work too.

So, how to specify the parameter of $scmp to refernce a string in program space?

Anyone can help me about this? TIA.